From 9844f6ae2512e7da6910e51c2d0d0f7da1550663 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Thu, 17 Feb 2022 10:44:03 -0600 Subject: about to dump unix-opt in favor of clon --- src/main.lisp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main.lisp b/src/main.lisp index 6c64ce2..0b33a6e 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -1,7 +1,8 @@ ;;;; main.lisp -- oneliners.cli entrypoint (defpackage oneliners.cli - (:use :cl)) + (:use :cl) + (:local-nicknames (#:api #:oneliners.api-client))) (in-package :oneliners.cli) ;;; CLI OPTIONS @@ -30,10 +31,7 @@ :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")) + :long "not-flagged")) (defparameter +help-suffix+ "Unless RESULT is an integer, search for oneliners that involve each command in COMMANDS. @@ -61,7 +59,7 @@ E.g. (defun last-search-file () (merge-pathnames ".last_oneliners_search" (user-homedir-pathname))) -;;; UTILITIES +;;; RUNNING COMMANDS (defun parent-process-name () "Prints the name of the parent process of the current process." @@ -104,3 +102,16 @@ printed to OUTPUT-STREAM. " (loop while (listen shell-output) do (princ (read-line shell-output) output-stream) (terpri output-stream)))))) + +;;; main + +(defun main () + (handler-case + (multiple-value-bind (options free-args) (opts:get-opts) + (print (list :options options :free-args free-args)) + (terpri) + (uiop:quit)) + (unix-opts:unknown-option (err) + (declare (ignore err)) + (princ (help-text)) + (terpri)))) -- cgit v1.2.3