From f4b6c94bbd91d5061f1a449f407999be7e8e5814 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 18 Feb 2022 12:41:23 -0600 Subject: config file checking and generation --- build-app.lisp | 58 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 15 deletions(-) (limited to 'build-app.lisp') diff --git a/build-app.lisp b/build-app.lisp index c7f8667..1b16837 100644 --- a/build-app.lisp +++ b/build-app.lisp @@ -1,14 +1,26 @@ +;;; build-app.lisp -- Contains the command line frontend definition +;;; to build the cli, simply load this file from the command line. + (asdf:load-system "oneliners.cli") (defpackage #:oneliners.cli.app (:use #:cl #:net.didierverna.clon) - (:local-nicknames (#:a #:alexandria))) + (:local-nicknames (#:a #:alexandria) + (#:cli #:oneliners.cli))) (in-package :oneliners.cli.app) -(defsynopsis (:postfix "TERMS ... | N ARGS ...") - (text :contents "Search for oneliner mentioning TERMS or run the Nth search result with arguments ARGS.") +;;; HELP TEXTS +(defparameter +invite-help-text+ + "") + + +;;; CLON SYNOPSIS DEFINITION + +(defsynopsis (:postfix "[TERMS ...] | N [ARGS ...]") (group (:header "Search") + (text :contents "Usage: ol [OPTIONS] [TERMS ...]") + (text :contents "Each term may be a command name or some tag like 'server' or 'tunnel'") (lispobj :long-name "count" :argument-type :optional :argument-name "Count" @@ -17,8 +29,22 @@ :typespec 'integer) (flag :long-name "not-flagged" :description "Request that no flagged oneliners are returned.")) + (text :contents " ") + (group (:header "Running Oneliners") + (text :contents "Usage: ol [OPTIONS] N [ARGS ...]") + (text :contents "Runs the Nth search result with possible arguments ARGS.") + (flag :long-name "clip" + :description "Force an attempt to copy the oneliner to the clipboard instead of running it.")) + (text :contents " ") + (group (:header "Help") + (flag :long-name "help" + :description "Print this help menu.") + (enum :long-name "help-topic" + :enum '(:admin :wiki :invites) + :argument-name "TOPIC" + :description "Print help for a topic. Topics are: wiki, admin, invites")) (group (:header "Wiki" :hidden t) - (text :contents "This is text") + (text :contents "This section documents options used to add and edit oneliners in the wiki.") (flag :long-name "add-interactive" :description "Interactively add a new oneliner") (flag :long-name "update-interactive" @@ -30,25 +56,26 @@ :argument-type :optional :default-value "DUMMY-TOKEN" :argument-name "TOKEN" - :description "Redeem an invite token. Enter an - interactive process of setting up a new contributor - account with the inviting server")) - (group (:header "Help") - (flag :long-name "help" - :description "Print this help menu.") - (enum :long-name "help-topic" - :enum '(:admin :wiki :search :help) - :argument-name "TOPIC" - :description "Print help for a topic. Topics are: search, wiki, admin, help"))) + :description "Redeem an invite token. See also --help-topic=invites")) + (group (:header "Invites" :hidden t) + (text :contents +invite-help-text+))) +;;; HELPERS + (defun find-group-with-header (header) + "This function should be built in. Is it? How to know? The +documentation is both extensive and trash. Any manual that expects +you to go to sleep with it at night is written for the author more +than the users." (loop for item in (net.didierverna.clon::items *synopsis*) when (and (typep item 'net.didierverna.clon::group) (string-equal header (net.didierverna.clon::header item))) return item)) +;;; MAIN ENTRY POINT + (defun main () "Entry point for our standalone application." (make-context) @@ -71,9 +98,10 @@ hist-number (rest arguments)) (uiop:quit)) - (format t "TBD: Going to search for commands mentioning the terms ~a~%" arguments)) + (cli:search-for-oneliners arguments :)) (uiop:quit)) +;;; DUMP EXECUTABLE (dump "ol" main) -- cgit v1.2.3