--whatelse is a better name than --describe-other-params

The use case is basically the user having forgotten, so --help would be
best, but it would be quite hard to include this in --help, since it may
even have to spin up an external special remote program.

I also considered --umm but typoed it the first time I tried it as
--uum, and while memorable, it's too cutesy. --whatelse is good because
it explicitly asks, what other params, besides the ones I've given?
This commit is contained in:
Joey Hess 2020-01-20 17:04:45 -04:00
parent 55f596e9b4
commit 5c6bf1be97
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 13 additions and 12 deletions

View file

@ -10,8 +10,9 @@ git-annex (7.20191231) UNRELEASED; urgency=medium
when foo=yes is expected. when foo=yes is expected.
* initremote, enableremote: Reject unknown configuration parameters * initremote, enableremote: Reject unknown configuration parameters
provided to these commands. provided to these commands.
* initremote: Added --describe-other-params option, to show additional * initremote: Added --whatelse option, to show additional
configuration parameters you might want to set. configuration parameters you might want to set. Eg:
git annex initremote type=directory encryption=none --whatelse
* Added LISTCONFIGS to external special remote protocol. Special remote * Added LISTCONFIGS to external special remote protocol. Special remote
programs that use GETCONFIG/SETCONFIG are recommended to implement it. programs that use GETCONFIG/SETCONFIG are recommended to implement it.

View file

@ -33,7 +33,7 @@ cmd = command "initremote" SectionSetup
data InitRemoteOptions = InitRemoteOptions data InitRemoteOptions = InitRemoteOptions
{ cmdparams :: CmdParams { cmdparams :: CmdParams
, sameas :: Maybe (DeferredParse UUID) , sameas :: Maybe (DeferredParse UUID)
, describeOtherParams :: Bool , whatElse :: Bool
} }
optParser :: CmdParamsDesc -> Parser InitRemoteOptions optParser :: CmdParamsDesc -> Parser InitRemoteOptions
@ -41,8 +41,8 @@ optParser desc = InitRemoteOptions
<$> cmdParams desc <$> cmdParams desc
<*> optional parseSameasOption <*> optional parseSameasOption
<*> switch <*> switch
( long "describe-other-params" ( long "whatelse"
<> short 'p' <> short 'w'
<> help "describe other configuration parameters for a special remote" <> help "describe other configuration parameters for a special remote"
) )
@ -74,7 +74,7 @@ start o (name:ws) = ifM (isJust <$> findExisting name)
(Logs.Remote.keyValToConfig Proposed ws) (Logs.Remote.keyValToConfig Proposed ws)
<$> readRemoteLog <$> readRemoteLog
t <- either giveup return (findType c) t <- either giveup return (findType c)
if describeOtherParams o if whatElse o
then startingCustomOutput (ActionItemOther Nothing) $ then startingCustomOutput (ActionItemOther Nothing) $
describeOtherParamsFor c t describeOtherParamsFor c t
else starting "initremote" (ActionItemOther (Just name)) $ else starting "initremote" (ActionItemOther (Just name)) $

View file

@ -21,7 +21,7 @@ The remote's configuration is specified by the parameters passed
to this command. Different types of special remotes need different to this command. Different types of special remotes need different
configuration values, so consult the documentation of a special remote for configuration values, so consult the documentation of a special remote for
details. The command will prompt for any required parameters you leave out; details. The command will prompt for any required parameters you leave out;
you can also pass --describe-other-params to see additional parameters. you can also pass --whatelse to see additional parameters.
A few parameters that are supported by all special remotes are documented in A few parameters that are supported by all special remotes are documented in
the next section below. the next section below.
@ -38,14 +38,14 @@ want to use `git annex renameremote`.
# OPTIONS # OPTIONS
* `--describe-other-params` / `-p` * `--whatelse` / `-w`
Describe additional configuration parameters that you could specify. Describe additional configuration parameters that you could specify.
For example, if you know you want a S3 remote, but forget how to For example, if you know you want a S3 remote, but forget how to
configure it: configure it:
git annex initremote mys3 type=S3 --describe-other-params git annex initremote mys3 type=S3 --whatelse
* `--fast` * `--fast`
@ -88,7 +88,7 @@ want to use `git annex renameremote`.
For details about this and other encrpytion settings, see For details about this and other encrpytion settings, see
<https://git-annex.branchable.com/encryption/> <https://git-annex.branchable.com/encryption/>
or --describe-other-params or --whatelse
* `autoenable` * `autoenable`

View file

@ -10,8 +10,8 @@ and indeed I get asked for e.g. encryption to be explicitly specified (why not t
[[!meta author=yoh]] [[!meta author=yoh]]
[[!tag projects/datalad]] [[!tag projects/datalad]]
> [[done]] as eg `git annex initremote type=rsync --describe-other-params`. > [[done]] as eg `git annex initremote type=rsync --whatelse`.
> >
> External special remotes that implement LISTCONFIGS can also be queried: > External special remotes that implement LISTCONFIGS can also be queried:
> >
> git annex inittype type=external externaltype=foo --describe-other-params > git annex inittype type=external externaltype=foo --whatelse