-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Many internal refactors, split stdlib from dt-only things
- Loading branch information
1 parent
b5c28d2
commit 6b3557c
Showing
7 changed files
with
104 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env dt | ||
|
||
# TODO: Try making a very simple repl-based shell | ||
|
||
ls .s | ||
|
||
repl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
### Flags and such ### | ||
|
||
[ [ action flag ]: | ||
args [ flag eq? ] any? | ||
action swap do? | ||
] \handle-flag def | ||
|
||
[ "dt " p version pl ] \print-version def | ||
|
||
[ [ print-version 0 exit ] "--version" handle-flag ] \--version def | ||
|
||
[ print-version | ||
[ "USAGE: dt FLAGS CODE..." | ||
"dt is \"duct tape\" for your unix pipes." | ||
"" | ||
"dt can be used in pipes to transform data with general purpose programming" | ||
"operations. It can also excel in short shebang scripts, or be explored as" | ||
"an interactive REPL (read-eval-print loop)." | ||
"" | ||
"More info at https://dt.plumbing" | ||
] pls | ||
0 exit | ||
] \print-help def | ||
|
||
[ [ print-help 0 exit ] "--help" handle-flag ] \--help def | ||
|
||
[ --help --version ] \handle-flags def | ||
|
||
[ handle-flags args unwords eval ] \run-args def! | ||
|
||
|
||
### PIPE things ### | ||
|
||
[ read-lines run-args ] \pipe-thru-args def! | ||
|
||
|
||
### Shebang things ### | ||
|
||
[ args deq swap drop ] \shebang-args def! | ||
|
||
|
||
### REPL things ### | ||
|
||
[ red "dt " p version pl norm inspire pl ] \repl-greet def | ||
|
||
[ \.q \quit def | ||
\.q \exit def | ||
] \repl-prelude def | ||
|
||
[ handle-flags repl-greet repl-prelude repl ] \main-repl def! | ||
|
||
[ "» " p read-line eval repl ] \repl def! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters