diff options
Diffstat (limited to 'src/main.lisp')
-rw-r--r-- | src/main.lisp | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/src/main.lisp b/src/main.lisp index d9cd0f5..e4916b7 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -6,9 +6,60 @@ ;;; CLI OPTIONS -;; (opts:define-opts -;; (:name )) +(opts:define-opts + (:name :add + :description "Intaractively add a oneliner to the a wiki." + :long "add") + (:name :tags + :description "A comma separated list of tags to filter search results." + :short #\t + :long "tags" + :arg-parser #'identity + :meta-var "'T1, T2, ...'") + (:name :limit + :description "An integer. The maximum number of results to return." + :short #\l + :long "limit" + :meta-var "N" + :default 10 + :arg-parser #'parse-integer) + (:name :edit + :description "An integer, a result number. Interactively edit af command." + :long "edit" + :meta-var "RESULT" + :arg-parser #'parse-integer) + (:name :not-flagged + :description "Filter flagged oneliners from the search results" + :long "not-flagged") + (:name :audited-only + :description "Filter unaudited oneliners from the search results" + :long "audited-only")) +(defparameter +help-suffix+ + "Unless RESULT is an integer, search for oneliners that involve each command in COMMANDS. +E.g. + # search for oneliners involving both 'find' and 'grep' + ol find grep + +Otherwise, when RESULT is an integer, run the oneliner with index RESULT from the most +recent search command, and supply ARGS to that oneliner, if provided. +E.g. + # run the third result from the last search with arguments foo and bar + ol 3 foo bar") + +(defun print-help () + (opts:describe :prefix "Oneliners Wiki Command Line Tool" + :args "[[RESULT ARGS | COMMANDS]" + :usage-of "ol" + :suffix +help-suffix+)) + +;;; CONFIG AND RESULTS FILE LOCATIONS + +(defun config-file () + (merge-pathnames ".config/oneliners.config" (user-homedir-pathname) )) + +(defun last-search-file () + (merge-pathnames ".last_oneliners_search" (user-homedir-pathname))) ;;; UTILITIES |