Bug 1867

Summary: Support "waf --args bar" shorthand for "waf --command-template="%s bar"
Product: ns-3 Reporter: Peter Barnes <pdbarnes>
Component: build systemAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: NEW ---    
Severity: enhancement CC: bswenson3, ns-bugs
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Peter Barnes 2014-03-02 02:37:46 EST
Right now, to run a program `foo' with argument `bar', the command is

  $ ./waf --run foo --command-template="%s bar"

waf should recognize `--args bar' as a shorthand for the above:

  $ ./waf --run foo --args bar
Comment 1 Brian Swenson 2014-04-22 18:14:01 EDT
Perhaps I'm missing something but can't you just do:

./waf --run "second -verbose=false"

instead of 

./waf --run second --command-template="%s -verbose=false" ?

Although I'm not sure how to get it to work with gdb

./waf --command-template="gdb %s" --run "second -verbose=false"

doesn't work but this:

./waf --command-template="gdb %s" --run "second"

along with:

start --verbose=false

does.
Comment 2 Brian Swenson 2014-04-22 18:29:12 EDT
I guess this works as well

./waf --run "second" --command-template="gdb --args %s -verbose=false"
Comment 3 Peter Barnes 2014-05-02 18:52:44 EDT
Well, I suppose you could be pedestrian and take Brian's suggestion:

./waf --run "second -verbose=false"

But I'm lazy and don't like the extra key strokes to get the string correct, and then to get back inside the quoted string to add an argument the next time.  Doesn't 

./waf --run second --args -verbose=false
./waf --run second --args -verbose=false -foo
./waf --run second --args -verbose=false -bar

look so much better?
Comment 4 Brian Swenson 2014-05-04 13:23:20 EDT
Well if you're counting key strokes

./waf --run "second -verbose=false" (35 key strokes)

vs

./waf --run second --args -verbose=false (40 key strokes)

Both are certainly better than this:

./waf --run second --command-template="%s -verbose=false"

which I'm too lazy to count.  Personally I think the 2nd way looks more confusing but that's just me.  I guess ideally it would support both.  A shortcut for gdb and valgrind would also be nice.