Skip to content

output and help #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

output and help #6

wants to merge 6 commits into from

Conversation

Bibiko
Copy link

@Bibiko Bibiko commented Sep 28, 2012

  • restructured general help output plus some changes in command descriptions
  • fixed bug of returning the underlying object for command "menu"
  • added the chance to add submenus (via key menu = {...}) for command "menu"
  • added the chance to return only value(s) for commands returning a plist by specifying the option "--output " or "--output '(array,of,keys)'" (esp. meant for BASH scripting or piping result)

Hans-Jörg Bibiko added 3 commits September 27, 2012 19:34
• `$DIALOG help` now outputs a sorted and more structured list of registered commands
…f separators or headers by setting and passing [NSMenuItem representedObject]

• add the chance to add submenus by the dictionary key "menu" and the same top level structure (see $DIALOG help menu)
…g a property list by adding the option '--output <key(s)>'

- changed [TMDCommand writePropertyList:toFileHandle: withProxy:]
- added "Options" to general help output
@sorbits
Copy link
Member

sorbits commented Oct 1, 2012

Why did you move to a multi-line summary?

Normally summary should be short and the user can then do "$DIALOG" help «command» for more info about the command.

As for --output I would name that --filter as the former is traditionally used to redirect output into a file.

I’m a little unclear on the “arrays of keys” — what is the format of this? Is that ASCII plist array syntax? Do we really want to support that?

@Bibiko
Copy link
Author

Bibiko commented Oct 1, 2012

• Re: multi-line summary
Ok, I'll add additional help to "$DIALOG" help «command» and (re-)shorten the summary.

• I'll also rename --output to --filter.

• Re: arrays of keys
Well, my intension was to be able to specify more than one key for outputting, this esp. useful for BASH scripting in a pipe if the dialog is a self-made complex NIB; like:
$DIALOG --filter '(foo,bar)' nib foo | perl -e 'while(<>) {... do something with the value of the 'foo' key; then with the 'bar's value; etc ...}'

--filter '(foo,bar)' will return a plain text string where the values of the keys foo and bar are delimited by a new line \n . This format can be read quite easily with any language. To read a plist with Perl e.g., well one has to install such a package in beforehand.

Regards,
Hans

@sorbits
Copy link
Member

sorbits commented Oct 1, 2012

OK, btw: when you write commit messages please first write a summary of the commit’s changes (one short line) and then a blank line followed by detailed description / analysis.

Your current style (without the blank line and with the bullet) has git confused, try e.g.: git log -n3 --oneline to view your last 3 commits. Would be nicer if that gave something like:

a0b0dd3 Allow filtering plist output via --filter
6943cdb Fix wrong result from menu command
xxxxxxx Add support for submenus
1593d9b Updated command descriptions

(note I also broke up one of your commits into two, since it was both fixing a bug and introducing a feature, we generally want each fix/change isolated in its own commit)

Hans-Jörg Bibiko added 3 commits October 2, 2012 06:05
- only one line for description
- made usage output more consistent
- added missing options to usage
- --icon argument can be a valid image file path or a known image name
- --suppression 'title' shows a check box with 'title' as label; the state of this check box will returned as 'suppressionButtonState' in the plist
@Bibiko
Copy link
Author

Bibiko commented Oct 2, 2012

Allan,

is it now Ok?

I also added to command 'alert' the options --icon and --suppression for more flexibility

Cheers,
--Hans

@sorbits
Copy link
Member

sorbits commented Oct 24, 2012

You added 3 new commits rather than cleanup the existing 3 commits.

As for array of keys, I think we should drop this option as it seems very ad hoc and not self-explanatory from the help alone. It also seems the same can be achieved by setting a custom key in the plist with multiple newline delimited values, and ask to get that key back (untested); though I’d say if doing “complex” stuff with DIALOG (which require multiple results back), perhaps one shouldn’t use a crude bash script but instead something that actually deals with property lists, so we also ensure proper string encoding/escaping etc.

@sorbits
Copy link
Member

sorbits commented Oct 24, 2012

P.S. Sorry it took so long to reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants