Skip to content
This repository has been archived by the owner on Nov 13, 2022. It is now read-only.

Commit

Permalink
rip.cd.rip: improve help
Browse files Browse the repository at this point in the history
Correctly show default option values (which can now come from the configuration).
  • Loading branch information
benoit-pierre committed Mar 1, 2015
1 parent bc7de37 commit 2d51c78
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions morituri/rip/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,13 @@ def addOptions(self):
help="output directory; will be included in file paths in result "
"files "
"(defaults to absolute path to current directory; set to "
"empty if you want paths to be relative instead) ")
"empty if you want paths to be relative instead; "
"configured value: %default) ")

This comment has been minimized.

Copy link
@thomasvs

thomasvs Mar 1, 2015

Not sure I follow - no default is set here, so what does showing %default do? Can you show me what this outputs?

This comment has been minimized.

Copy link
@benoit-pierre

benoit-pierre Mar 1, 2015

Author Owner

With no configuration:

  -O OUTPUT_DIRECTORY, --output-directory=OUTPUT_DIRECTORY
                        output directory; will be included in file paths in
                        result files (defaults to absolute path to current
                        directory; set to empty if you want paths to be
                        relative instead; configured value: none)

With this configuration:

[rip.cd rip]
unknown = True
output_directory = ~/desktop/music
track_template = new/%%A/%%y - %%d/%%t - %%n
disc_template = %(track_template)s
profile = flac

It shows:

  -O OUTPUT_DIRECTORY, --output-directory=OUTPUT_DIRECTORY
                        output directory; will be included in file paths in
                        result files (defaults to absolute path to current
                        directory; set to empty if you want paths to be
                        relative instead; configured value: ~/desktop/music)

This is because the defaults are overridden by the call to set_defaults before the actual parsing of the arguments, since we want the priority to be: option defaults at parser creation (add_option) > configuration values > command line values.

self.parser.add_option('-W', '--working-directory',
action="store", dest="working_directory",
help="working directory; morituri will change to this directory "
"and files will be created relative to it when not absolute ")
"and files will be created relative to it when not absolute "
"(configured value: %default) ")

rcommon.addTemplate(self)

Expand All @@ -223,8 +225,8 @@ def addOptions(self):

self.parser.add_option('', '--profile',
action="store", dest="profile",
help="profile for encoding (default '%s', choices '%s')" % (
default, "', '".join(encode.PROFILES.keys())),
help="profile for encoding (default '%%default', choices '%s')" % (

This comment has been minimized.

Copy link
@thomasvs

thomasvs Mar 1, 2015

Are you sure it's a double percent?

This comment has been minimized.

Copy link
@benoit-pierre

benoit-pierre Mar 1, 2015

Author Owner

Yes! 2 interpolations:

  • first one by us to set choices
  • the second one done by the parser to change %default
"', '".join(encode.PROFILES.keys())),
default=default)
self.parser.add_option('-U', '--unknown',
action="store_true", dest="unknown",
Expand Down

0 comments on commit 2d51c78

Please sign in to comment.