aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--TODOs.org2
-rwxr-xr-xcli43
-rw-r--r--default.nix1
3 files changed, 46 insertions, 0 deletions
diff --git a/TODOs.org b/TODOs.org
index 7cd1688..d5071a5 100644
--- a/TODOs.org
+++ b/TODOs.org
@@ -5,6 +5,8 @@ https://joelkuiper.eu/spellcheck_emacs
=rsync= isn't sending new versions of existing files to the server.
** TODO Add articles teaser to homepage
https://jaspervdj.be/hakyll/tutorials/using-teasers-in-hakyll.html
+* CLI
+** Print usage when no subcommand is provided
* CI
** Improvements
*** Use NixOS instead of Debian?
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))
diff --git a/default.nix b/default.nix
index 7b297d2..aba5d38 100644
--- a/default.nix
+++ b/default.nix
@@ -41,6 +41,7 @@ in with pkgs; with pkgs.stdenv; rec {
buildInputs = [
websiteBuilder
(pkgs.haskellPackages.ghcWithPackages (p: with p; [ hakyll ]))
+ racket
];
};
publishScript = pkgs.writeShellScriptBin "publish.sh" ''