[Assword] Proposal for an extensible command line syntax

Olivier Guerrier olivier at guerrier.com
Wed Oct 23 19:17:29 EDT 2013


Dear list,

Please find below a proposal to change to command line syntax of 
assword. I've tried to keep as much as possible from the existing, But 
there is no full backward compatibility.

The mid-term idea is to extend the features of assword, but this can't 
be done without adding more options and command keywords.

Instead of just 'hacking' and adding to the existing, here is a first 
draft trying to prepare the existing for such extensions.
(I already have a few in mind but let's discuss one step at a time)

There are several possibles input sources for configuration, here is the
priority order, from highest to lowest:
1 - command line (top priority, always taken into account)
2 - environnement variables
3 - configuration file
4 - default internal values

naming convention:

- command line's keywords will be always lower case, only one word, no
   underscore
- configuration file's keyword will be the sames as the command line
- environnement variables will be uppercase and prefixed with ASSWORD_

fe: --keyfile : keyfile= : ASSWORD_KEYFILE=

Below is the help output of assword updated with what I have in mind, 
feel free to comment.

Regards,

---------------------------

Usage: assword [<options>] <command> [<args>...]

Options:

   --version          Report the version of this program

   --help             This help

   --ui=<value>       'cli' or 'gtk'. (default is cli)
                      'gui' is an alias to 'gtk'
     Note: Later, other ui mode can be added (fe: qt/efl/ncurses)

   --db=<path>        Path to assword database. Default: ~/.assword/db

   --keyfile=<path>   File containing OpenPGP key ID of database
                      encryption recipient. This will override
                      ASSWORD_KEYID
                      Default: ~/.assword/keyid

   --keyid=<id>       OpenPGP key ID of database encryption recipient
                      This will override --keyfile

   --input=<value>    'random' generate a random password
                      'stdin' read password from stdin
                      'prompt' use the --ui to ask the user

   --pwlen=<length>   Minimal length for password. Used as a fixed
                      length if --input is set to 'random'

   --format=<value>   'json', 'json+pw' or '<free text>'.
                      'json+pw' will also dump unencrypted passwords
                      If <free text> is given, several %foo% variables
                      will be replaced with the content of db fields.
                      Current variables are %context%, %date%, %password%
                      fe: "context=%context%,password=%password%"
                      Default is 'json'

   --paste=<method>   'xdo' attempts to type the password into the
                      window that had focus on launch
                      'xclip' inserts the password in the X clipboard
                      Default: xdo

Commands:

   add [<context>]    Add a new entry.  If context is '-' read from stdin
                      If not specified, user will be prompted for context
                      See ASSWORD_PASSWORD for information on passwords

   edit [<context>]   Edit an already existing entry

   dump [<string>]    Dump search results. If string not specified all
                      entries are returned. Passwords will not be
                      displayed unless ASSWORD_FORMAT or --format is set
                      to 'json+pw'

   paste [<string>]   Upon invocation the user will be prompted to
                      decrypt the database, after which a search prompt
                      will be presented. If an additional string is
                      provided, it will be added as the initial search
                      string. All matching results for the query will be
                      presented to the user. When a result is selected,
                      the password will be retrieved according to the
                      method specified by --paste. If no match is found,
                      the user has the opportunity to generate and store
                      a new password, which is then delivered.
                      Combined with --ui set to 'gui' it cans be used
                      for X11 window manager integration

   remove <context>   Delete an entry from the database.


Environment:

   ASSWORD_UI        'cli', 'gtk', 'gui'. See --ui

   ASSWORD_DB        Path to assword database file. See --db

   ASSWORD_KEYFILE   File containing OpenPGP key ID of database encryption
                     recipient. See --keyfile

   ASSWORD_KEYID     OpenPGP key ID of database encryption recipient. This
                     overrides ASSWORD_KEYFILE if set. See --keyid

   ASSWORD_INPUT     Method to generate passwords. See --input

   ASSWORD_PWLEN     Minimal length for password. See --pwlen

   ASSWORD_FORMAT    Format used to dump passwords. See --format

   ASSWORD_PASTE     Method for password retrieval. See --paste

-- 
Olivier


More information about the Assword mailing list