aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2018-12-24 18:03:26 -0200
committerEuAndreh <eu@euandre.org>2018-12-24 18:03:45 -0200
commitdfb1e2dfb491e7377287608f6ffbfd6f02991ccd (patch)
treee1b6067c7340bd52a5eea816d8a907bdf97b8ea6 /cli
parentBuild and publish website using Nix; remove Makefile. (diff)
downloadeuandre.org-dfb1e2dfb491e7377287608f6ffbfd6f02991ccd.tar.gz
euandre.org-dfb1e2dfb491e7377287608f6ffbfd6f02991ccd.tar.xz
Add initial Racket CLI for handling scripts.
Diffstat (limited to 'cli')
-rwxr-xr-xcli43
1 files changed, 43 insertions, 0 deletions
diff --git a/cli b/cli
new file mode 100755
index 0000000..a2f8a44
--- /dev/null
+++ b/cli
@@ -0,0 +1,43 @@
+#!/usr/bin/env racket
+#lang racket
+
+(define pastebin-verbose? (make-parameter #false))
+(define pastebin-title (make-parameter ""))
+(define slide-verbose? (make-parameter #false))
+
+(define subcommand
+ (command-line
+ #:program "website-cli"
+ #:args (subcommand . subcommand-options)
+ (match subcommand
+ ["pastebin"
+ (command-line
+ #:program "website-cli pastebin"
+ #:argv subcommand-options
+ #:multi
+ [("-v" "--verbose") "dunno" (pastebin-verbose? #true)]
+ [("-t" "--title") title "The title of the pastebin, will be slugified for creating the filename." (pastebin-title title)])]
+ ["slide"
+ (command-line
+ #:program "website-cli slide"
+ #:argv subcommand-options
+ #:usage-help
+ "woeifj ijfe"
+ #:multi
+ [("-v" "--verbose") "Turn on verbose mode" (slide-verbose? #false)]
+ #:help-labels
+ "oefijeifjeijfiejfijeij ijij"
+ #:ps "ps")]
+ [_
+ (printf "Invalid subcommand: ~a\n" subcommand)
+ (exit 1)])
+ subcommand))
+
+(define out
+ (match subcommand
+ ["pastebin"
+ (system "./pastebin/new.sh")]
+ ["slide"
+ (system "./slides/new.sh")]))
+
+(exit (if out 0 1))