Project

General

Profile

Story #2386

refactor CLI to use command line switches when non-interactive

Added by Matthew Jones almost 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrew Pippin
Category:
d1_client_cli
Start date:
2012-03-02
Due date:
% Done:

100%

Story Points:
Sprint:

Description

The CLI application has been refactored to use an interactive command set that allows a fluid interaction with the system. This works well in interactive mode, but the use of these same 'commands' is awkward and atypical of command-line applications. The CLI should be refactored to:

  1. Add a switch to indicate that the command should be run in interactive more (-i, --interactive)
  2. Accept a set of command line switches (e.g., --mn-url) using the GNU options format that set the values of parameters from the commandline when not in interactive mode
  3. Accept a single command when not in interactive mode, followed by its parameters

So, for example:

d1_client --mn-url https://some.mn.url/mn/v1 --cert-file /tmp/mycert.pem create testid.1.1 myfile.csv

We'll need to discuss the exact syntax of the commandset, but in general it should be identical to the interactive commands.


Subtasks

Task #2427: Convert previous session variables to new session variablesClosedAndrew Pippin

History

#1 Updated by Matthew Jones almost 13 years ago

  • Category set to d1_client_cli
  • Assignee set to Andrew Pippin
  • Target version set to Sprint-2012.07-Block.1.4

#2 Updated by Matthew Jones almost 13 years ago

  • Position deleted (2)
  • Position set to 2

#3 Updated by Dave Vieglais over 12 years ago

  • Position set to 19
  • Target version changed from Sprint-2012.07-Block.1.4 to Sprint-2012.09-Block.2.1
  • Position deleted (1)

#4 Updated by Andrew Pippin over 12 years ago

| Currently | Proposed |
| authoritativemn | authoritative-mn, or auth-mn |
| certpath | cert-file |
| dataoneurl | dataone-url |
| fromdate | from-date |
| keypath | key-file |
| mnurl | mn-url |
| objectformat | object-format |
| originmn | origin-mn |
| rightsholder | rights-holder |
| searchobjectformat | search-object-format |
| todate | to-date |

Unchanged:
    algorithm, anonymous, count, fields, pretty, query, start, submitter, verbose

#5 Updated by Andrew Pippin over 12 years ago

  • Status changed from New to In Progress

#6 Updated by Andrew Pippin over 12 years ago

See below for the options.

The boolean options (anonymous, interactive, pretty) have "no" options as well. The opposite of verbose is often "quiet", so that is also an option.

Usage: dataone.py [command] ...

Options:
--algorithm=ALGORITHM
Checksum algorithm used for a Science Data Object.
--anonymous Ignore any installed certificates and connect
anonymously
--no-anonymous Ignore any installed certificates and connect
anonymously
--auth-mn=MN-URI Authoritative Member Node for generating System
Metadata.
--cert-file=FILE Path to client certificate
--count=COUNT Maximum number of items to display
--dataone-url=CN-URI Node to use for the root Coordinating Node
--fields=FIELDS Comma delimited list of index fields to return in
search responses
--from-date=DATE Start time used by operations that accept a date range
-i, --interactive Allow interactive commands
--no-interactive Don't allow interactive commands
--key-file=FILE File of client private key (not required if key is in
cert-file
--mn-url=MN-URI Member Node URL
--object-format=OBJECT-FORMAT
ID for the Object Format to use when generating System
Metadata
--origin-mn=MN-URI Originating Member Node to use when generating System
Metadata
--pretty Display XML with human friendly formatting
--no-pretty Display XML with human friendly formatting
--query=QUERY Query string (SOLR or Lucene query syntax) for
searches
-q, --quiet Display less information
--rights-holder=SUBJECT
Subject of the rights holder to use when generating
System Metadata
--search-object-format=OBJECT-FORMAT
Include only objects of this format when searching
--start=START First item to display for operations that display a
list of items
--submitter=SUBJECT Subject of the submitter to use when generating System
Metadata
--to-date=DATE End time used by operations that accept a date range
-v, --verbose Display more information
--no-verbose Display less information
-h, --help show this help message and exit

#7 Updated by Andrew Pippin over 12 years ago

The session information is replaced with the values from @~/.d1client.conf@. However, those values may not (probably won't) be the same for awhile. Should the application:

just silently change them and save new ones?

update the d1client.conf file with the new values and inform the user?

abort and have a special command be run to map them?

I vote for number 2, because I don't like programs changing my configuration files without letting me know.

#8 Updated by Andrew Pippin over 12 years ago

  • % Done changed from 0 to 90

Need to determine how to transition from previous state.

#9 Updated by Andrew Pippin over 12 years ago

  • Status changed from In Progress to Closed

  The CLI is now able to convert the previous session variable names to the new "dashed" session variable names (see #2427).

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)