Jump to content


get long style options for a command


  • Please log in to reply
6 replies to this topic

#1 JoeRiel

JoeRiel

    Member

  • Members
  • PipPip
  • 19 posts

Posted 08 March 2019 - 09:15 PM

I was recently shown, or stumbled into, a way to see the long style options for p4 commands, but don't recall what the trick was.  What is the trick?

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 764 posts

Posted 08 March 2019 - 09:24 PM

IIRC "p4 help usage" has helpful tricks like that.

#3 JoeRiel

JoeRiel

    Member

  • Members
  • PipPip
  • 19 posts

Posted 08 March 2019 - 09:26 PM

Ah, the trick is to add the option --explain in a call to the command:  p4 changes --explain

#4 JoeRiel

JoeRiel

    Member

  • Members
  • PipPip
  • 19 posts

Posted 08 March 2019 - 09:29 PM

Alas, it doesn't work with the bare p4 command, say to return long-style options for -x, etc:
p4 --explain  --> Segmentation fault

#5 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 764 posts

Posted 08 March 2019 - 10:40 PM

Heh, that seems like a bug.  :D  You can always get the client-side usage out of the client source, though.  The set of global options is defined here:

https://swarm.worksh...ientmain.cc#224

and the corresponding "long option" strings live in:

https://swarm.worksh...port/options.cc

#6 JoeRiel

JoeRiel

    Member

  • Members
  • PipPip
  • 19 posts

Posted 08 March 2019 - 11:22 PM

The long-option --filter for -F doesn't work, at least not as p4 --filter "..." ...

#7 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 764 posts

Posted 08 March 2019 - 11:42 PM

"filter" isn't one of the client long opts...

static int clientLongOpts[] = { Options::Client,
				   Options::Batchsize, Options::User,
				   Options::Host, Options::Charset,
				   Options::Help, Options::Port, Options::Password,
				   Options::CmdCharset, Options::Retries,
				   Options::Quiet, Options::Progress,
				   Options::MessageType, Options::Directory,
				   Options::Variable, Options::Xargs, 
				   Options::Aliases, Options::Field, 0 };

IIRC the global "-F" flag doesn't have a long form, but if it did it'd be "format".




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users