Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more to the stdlib #90

Merged
merged 13 commits into from
Dec 9, 2023
20 changes: 12 additions & 8 deletions .dune-prelude
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ if os@name == "windows" {

let cat = fs@read;
} else {
if (fs@exists HOME + "/.cargo/bin/bat") {
if (fs@exists? HOME + "/.cargo/bin/bat") {
let cat = 'bat;
}
if (fs@exists HOME + "/.cargo/bin/lsd") {
if (fs@exists? HOME + "/.cargo/bin/lsd") {
let ls = 'lsd;
}
}
Expand Down Expand Up @@ -462,15 +462,16 @@ let turnedshrew = _ ~> {
let shrewsay = text -> {
let title = "Wild Dune Shrew";


let cols = 22;
let text = (std@string@to-string text);
let cols = math@min (math@max ((console@width ()) // 2) (string@get-width text)) (console@width ());
let text = fmt@wrap text cols;
let text-lines = lines text;
if (len text-lines) == 1 {
if (len text) < cols {
let cols = len text;
}
}
let cols = math@max cols (len title);
let rows = len text-lines;
let spacing = 25;

Expand All @@ -487,15 +488,18 @@ let shrewsay = text -> {

let turnedshrewsay = text -> {
let title = "Wild Dune Shrew";
let text = (std@string@to-string text);

let cols = 27;
let text = (std@string@to-string text);
let cols = math@min (math@max ((console@width ()) // 2) (string@get-width text)) (console@width ());
let text = fmt@wrap text cols;
let text-lines = lines text;
if (len text-lines) == 1 {
if (len text) < cols {
let cols = len text;
}
}
let cols = math@max cols (len title);
let rows = len text-lines;
let spacing = 20;

Expand Down Expand Up @@ -608,7 +612,7 @@ let welcomebanner = _ ~> {
else if now@month == 12 (if now@day < 22 "🏹" else "🐐")
else "⭐";
echo "┌─────────────────Welcome to ...─────────────────┐";
for ch in (chars logo) {
for ch in (string@chars logo) {
print (fmt@bold (if ch == "█" {
fmt@faint (fmt@red ch)
} else {
Expand Down Expand Up @@ -730,14 +734,14 @@ let welcome = _ ~> {
let DUNE_SECRETS_FILE = HOME + "/.dune-secrets";

clear ();
if (fs@exists DUNE_SECRETS_FILE) {
if (fs@exists? DUNE_SECRETS_FILE) {
include DUNE_SECRETS_FILE;
}

let CITY = Knoxville;
welcome ();


if (!(fs@exists DUNE_SECRETS_FILE)) {
if (!(fs@exists? DUNE_SECRETS_FILE)) {
shrewsay "Create " + DUNE_SECRETS_FILE + " to store your secrets, tokens, and API keys!";
}
Loading