From c209e0f643ef7f582aebe00bc6f0ee1586b9a9cf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Feb 2023 18:09:10 -0400 Subject: [PATCH] add FIELD?=GLOB to git-annex view usage And also to vadd usage. Also added some other things to the usage that were omitted before to save space. Adding even FIELD?=GLOB made the git-annex --help list of commands grow too wide for an 80 column display. So, removed the description of parameters from that list of commands. Sponsored-By: Brock Spratlen on Patreon --- CmdLine/Usage.hs | 4 ---- Command.hs | 2 +- Command/VAdd.hs | 5 ++--- Command/View.hs | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CmdLine/Usage.hs b/CmdLine/Usage.hs index 65879f7c3e..4943eaeb16 100644 --- a/CmdLine/Usage.hs +++ b/CmdLine/Usage.hs @@ -32,17 +32,13 @@ commandList cmds = concatMap go [minBound..] cmdline c = concat [ cmdname c , namepad (cmdname c) - , cmdparamdesc c - , descpad (cmdparamdesc c) , cmddesc c ] pad n s = replicate (n - length s) ' ' namepad = pad $ longest cmdname + 1 - descpad = pad $ longest cmdparamdesc + 2 longest f = foldl max 0 $ map (length . f) cmds scmds = sort cmds - {- Descriptions of params used in usage messages. -} paramPaths :: String paramPaths = paramRepeating paramPath -- most often used diff --git a/Command.hs b/Command.hs index 67d10dd125..b446da07ad 100644 --- a/Command.hs +++ b/Command.hs @@ -66,7 +66,7 @@ noMessages c = c { cmdnomessages = True } {- Adds a fallback action to a command, that will be run if it's used - outside a git repository. -} -noRepo :: (String -> Parser (IO ())) -> Command -> Command +noRepo :: (CmdParamsDesc -> Parser (IO ())) -> Command -> Command noRepo a c = c { cmdnorepo = Just (a (cmdparamdesc c)) } {- Adds Annex options to a command. -} diff --git a/Command/VAdd.hs b/Command/VAdd.hs index 924ea47865..e190eb1260 100644 --- a/Command/VAdd.hs +++ b/Command/VAdd.hs @@ -10,14 +10,13 @@ module Command.VAdd where import Command import qualified Annex import Annex.View -import Command.View (checkoutViewBranch) +import Command.View (checkoutViewBranch, paramView) cmd :: Command cmd = notBareRepo $ command "vadd" SectionMetaData "add subdirs to current view" - (paramRepeating "FIELD=GLOB") - (withParams seek) + paramView (withParams seek) seek :: CmdParams -> CommandSeek seek = withWords (commandAction . start) diff --git a/Command/View.hs b/Command/View.hs index af32ca5892..a22d78bc4c 100644 --- a/Command/View.hs +++ b/Command/View.hs @@ -78,7 +78,7 @@ perform view = do next $ checkoutViewBranch view applyView paramView :: String -paramView = paramRepeating "FIELD=VALUE" +paramView = paramRepeating "TAG FIELD=GLOB ?TAG FIELD?=GLOB FIELD!=VALUE" mkView :: [String] -> Annex View mkView ps = go =<< inRepo Git.Branch.current