<< Back to previous view

[TCLI-86] Global options Created: 16/Jun/16  Updated: 16/Jun/16

Status: Open
Project: tools.cli
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Dan Persa Assignee: Sean Corfield
Resolution: Unresolved Votes: 0
Labels: None


When parsing the options, when the in-order flag is true, it would be nice to be able so define some options as global. The global options should not be passed as arguments to the sub-command.

Looking at the example:

git --git-dir=/other/proj/.git log --oneline --graph

With :in-order true, the parsing looks like:

options:   [[--git-dir /other/proj/.git]]
arguments: [log --oneline --graph]

If --graph would be a global option, it would modify the parsing to:

options:   [[--git-dir /other/proj/.git] [--graph]]
arguments: [log --oneline]

My suggestion would be, when defining the options, to add a flag, :global, by default set to false:

(def cli-options
  [["-o" "--oneline" "One line"]
   ["-g" "--graph" "Some graph" :global true]
   ["-h" "--help" "Displays this" :default false :global true]])

Comment by Sean Corfield [ 16/Jun/16 12:02 PM ]

Sounds like a reasonable enhancement. I'll take a look and see whether that is feasible with the current machinery.

Generated at Sat Jun 25 03:50:11 CDT 2016 using JIRA 4.4#649-r158309.