Skip to content

Commit

Permalink
Merge pull request #90 from adam-mcdaniel/std-lib
Browse files Browse the repository at this point in the history
Added more to the stdlib
  • Loading branch information
adam-mcdaniel authored Dec 9, 2023
2 parents cf49d18 + d145738 commit 10f1aaa
Show file tree
Hide file tree
Showing 24 changed files with 2,755 additions and 231 deletions.
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

0 comments on commit 10f1aaa

Please sign in to comment.