Skip to content

Commit

Permalink
Add more groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Feb 4, 2024
1 parent 16785b6 commit 4332128
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 58 deletions.
26 changes: 17 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ CLI Usage

usage: musescore-manager [-h] [--print-completion {bash,zsh,tcsh}]
[-C <file-path>] [-b] [-d] [--catch-errors] [-m]
[-e FILE_PATH] [-V] [-v] [-k] [--diff] [--print-xml]
[-E <extension>] [--compress] [-c <fields>] [-D]
[-e FILE_PATH] [-E <extension>] [--compress] [-V] [-v]
[-k] [--diff] [--print-xml] [-c <fields>] [-D]
[-i <source-fields> <format-string>] [-j]
[-l <log-file> <format-string>] [-y]
[-S <field> <format-string>]
Expand Down Expand Up @@ -452,13 +452,10 @@ CLI Usage
the XML with lxml to avoid differences in the XML structure.
-e FILE_PATH, --executable FILE_PATH
Path of the musescore executable.
-V, --version show program's version number and exit
-v, --verbose Make commands more verbose. You can specifiy multiple
arguments (. g.: -vvv) to make the command more verbose.
-k, --colorize Colorize the command line print statements.
--diff Show a diff of the XML file before and after the
manipulation.
--print-xml Print the XML markup of the score.

export:
Export the scores in different formats.

-E <extension>, --export <extension>
Export the scores in a format defined by the extension. The
exported file has the same path, only the file extension is
Expand All @@ -471,6 +468,17 @@ CLI Usage
--compress Save an uncompressed MuseScore file (*.mscx) as a compressed
file (*.mscz).

info:
Print informations about the score and the CLI interface itself.

-V, --version show program's version number and exit
-v, --verbose Make commands more verbose. You can specifiy multiple
arguments (. g.: -vvv) to make the command more verbose.
-k, --colorize Colorize the command line print statements.
--diff Show a diff of the XML file before and after the
manipulation.
--print-xml Print the XML markup of the score.

meta:
Deal with meta data informations stored in the MuseScore file.

Expand Down
4 changes: 2 additions & 2 deletions autocomplete.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@



_shtab_musescore_manager_option_strings=('-h' '--help' '--print-completion' '-C' '--config-file' '-b' '--backup' '-d' '--dry-run' '--catch-errors' '-m' '--mscore' '--save-in-mscore' '-e' '--executable' '-V' '--version' '-v' '--verbose' '-k' '--colorize' '--diff' '--print-xml' '-E' '--export' '--compress' '-c' '--clean-meta' '-D' '--delete-duplicates' '-i' '--distribute-fields' '-j' '--json' '-l' '--log' '-y' '--synchronize' '-S' '--set-field' '--metatag' '--metatag-meta' '--vbox' '--vbox-meta' '--title' '--subtitle' '--composer' '--lyricist' '-x' '--extract' '--extract-lyrics' '-r' '--remap' '--remap-lyrics' '-F' '--fix' '--fix-lyrics' '--rename' '-t' '--target' '--only-filename' '-A' '--alphanum' '-a' '--ascii' '-n' '--no-whitespace' '-K' '--skip-if-empty' '-L' '--list-files' '-g' '--glob' '--mscz' '--mscx' '-s' '--style' '--clean' '-Y' '--style-file' '--s3' '--styles-v3' '--s4' '--styles-v4' '--list-fonts' '--text-font' '--title-font' '--musical-symbol-font' '--musical-text-font' '--staff-space' '--page-size' '--a4' '--din-a4' '--letter' '--margin' '--show-header' '--no-show-header' '--header-first-page' '--no-header-first-page' '--different-odd-even-header' '--no-different-odd-even-header' '--header' '--header-odd-even' '--show-footer' '--no-show-footer' '--footer-first-page' '--no-footer-first-page' '--different-odd-even-footer' '--no-different-odd-even-footer' '--footer' '--footer-odd-even' '--reset-small-staffs')
_shtab_musescore_manager_option_strings=('-h' '--help' '--print-completion' '-C' '--config-file' '-b' '--backup' '-d' '--dry-run' '--catch-errors' '-m' '--mscore' '--save-in-mscore' '-e' '--executable' '-E' '--export' '--compress' '-V' '--version' '-v' '--verbose' '-k' '--colorize' '--diff' '--print-xml' '-c' '--clean-meta' '-D' '--delete-duplicates' '-i' '--distribute-fields' '-j' '--json' '-l' '--log' '-y' '--synchronize' '-S' '--set-field' '--metatag' '--metatag-meta' '--vbox' '--vbox-meta' '--title' '--subtitle' '--composer' '--lyricist' '-x' '--extract' '--extract-lyrics' '-r' '--remap' '--remap-lyrics' '-F' '--fix' '--fix-lyrics' '--rename' '-t' '--target' '--only-filename' '-A' '--alphanum' '-a' '--ascii' '-n' '--no-whitespace' '-K' '--skip-if-empty' '-L' '--list-files' '-g' '--glob' '--mscz' '--mscx' '-s' '--style' '--clean' '-Y' '--style-file' '--s3' '--styles-v3' '--s4' '--styles-v4' '--list-fonts' '--text-font' '--title-font' '--musical-symbol-font' '--musical-text-font' '--staff-space' '--page-size' '--a4' '--din-a4' '--letter' '--margin' '--show-header' '--no-show-header' '--header-first-page' '--no-header-first-page' '--different-odd-even-header' '--no-different-odd-even-header' '--header' '--header-odd-even' '--show-footer' '--no-show-footer' '--footer-first-page' '--no-footer-first-page' '--different-odd-even-footer' '--no-different-odd-even-footer' '--footer' '--footer-odd-even' '--reset-small-staffs')

_shtab_musescore_manager_pos_0_COMPGEN=_shtab_compgen_files
_shtab_musescore_manager__C_COMPGEN=_shtab_compgen_files
Expand All @@ -29,6 +29,7 @@ _shtab_musescore_manager___catch_errors_nargs=0
_shtab_musescore_manager__m_nargs=0
_shtab_musescore_manager___mscore_nargs=0
_shtab_musescore_manager___save_in_mscore_nargs=0
_shtab_musescore_manager___compress_nargs=0
_shtab_musescore_manager__V_nargs=0
_shtab_musescore_manager___version_nargs=0
_shtab_musescore_manager__v_nargs=0
Expand All @@ -37,7 +38,6 @@ _shtab_musescore_manager__k_nargs=0
_shtab_musescore_manager___colorize_nargs=0
_shtab_musescore_manager___diff_nargs=0
_shtab_musescore_manager___print_xml_nargs=0
_shtab_musescore_manager___compress_nargs=0
_shtab_musescore_manager__D_nargs=0
_shtab_musescore_manager___delete_duplicates_nargs=0
_shtab_musescore_manager__i_nargs=2
Expand Down
4 changes: 2 additions & 2 deletions autocomplete.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ _shtab_musescore_manager_options=(
"--catch-errors[Print error messages instead stop execution in a batch run.]"
{-m,--mscore,--save-in-mscore}"[Open and save the XML file in MuseScore after manipulating the XML with lxml to avoid differences in the XML structure.]"
{-e,--executable}"[Path of the musescore executable.]:general_executable:_files"
{-E,--export}"[Export the scores in a format defined by the extension. The exported file has the same path, only the file extension is different. Further information can be found at the MuseScore website\: https\:\/\/musescore.org\/en\/handbook\/2\/file-formats, https\:\/\/musescore.org\/en\/handbook\/3\/file-export, https\:\/\/musescore.org\/en\/handbook\/4\/file-export. MuseScore must be installed and the script must know the location of the binary file.]:export_extension:(mscz mscx spos mpos pdf svg png wav mp3 ogg flac mid midi kar musicxml xml mxl brf mei)"
"--compress[Save an uncompressed MuseScore file (\*.mscx) as a compressed file (\*.mscz).]"
"(- : *)"{-V,--version}"[show program\'s version number and exit]"
"*"{-v,--verbose}"[Make commands more verbose. You can specifiy multiple arguments (. g.\: -vvv) to make the command more verbose.]"
{-k,--colorize}"[Colorize the command line print statements.]"
"--diff[Show a diff of the XML file before and after the manipulation.]"
"--print-xml[Print the XML markup of the score.]"
{-E,--export}"[Export the scores in a format defined by the extension. The exported file has the same path, only the file extension is different. Further information can be found at the MuseScore website\: https\:\/\/musescore.org\/en\/handbook\/2\/file-formats, https\:\/\/musescore.org\/en\/handbook\/3\/file-export, https\:\/\/musescore.org\/en\/handbook\/4\/file-export. MuseScore must be installed and the script must know the location of the binary file.]:export_extension:(mscz mscx spos mpos pdf svg png wav mp3 ogg flac mid midi kar musicxml xml mxl brf mei)"
"--compress[Save an uncompressed MuseScore file (\*.mscx) as a compressed file (\*.mscz).]"
{-c,--clean-meta}"[Clean the meta data fields. Possible values\: \„all\“ or a comma separated list of fields, for example\: \„field_one,field_two\“.]:meta_clean:"
{-D,--delete-duplicates}"[Deletes lyricist if this field is equal to composer. Deletes subtitle if this field is equal totitle. Move subtitle to combimed_title if title is empty.]"
"*"{-i,--distribute-fields}"[Distribute source fields to target fields by applying a format string on the source fields. It is possible to apply multiple --distribute-fields options. \<source-fields\> can be a single field or a comma separated list of fields\: field_one,field_two. The program tries first to match the \<format-string\> on the first source field. If thisfails, it tries the second source field ... and so on.]:meta_dist:"
Expand Down
26 changes: 17 additions & 9 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Comande line interface

usage: musescore-manager [-h] [--print-completion {bash,zsh,tcsh}]
[-C <file-path>] [-b] [-d] [--catch-errors] [-m]
[-e FILE_PATH] [-V] [-v] [-k] [--diff] [--print-xml]
[-E <extension>] [--compress] [-c <fields>] [-D]
[-e FILE_PATH] [-E <extension>] [--compress] [-V] [-v]
[-k] [--diff] [--print-xml] [-c <fields>] [-D]
[-i <source-fields> <format-string>] [-j]
[-l <log-file> <format-string>] [-y]
[-S <field> <format-string>]
Expand Down Expand Up @@ -60,13 +60,10 @@ Comande line interface
the XML with lxml to avoid differences in the XML structure.
-e FILE_PATH, --executable FILE_PATH
Path of the musescore executable.
-V, --version show program's version number and exit
-v, --verbose Make commands more verbose. You can specifiy multiple
arguments (. g.: -vvv) to make the command more verbose.
-k, --colorize Colorize the command line print statements.
--diff Show a diff of the XML file before and after the
manipulation.
--print-xml Print the XML markup of the score.

export:
Export the scores in different formats.

-E <extension>, --export <extension>
Export the scores in a format defined by the extension. The
exported file has the same path, only the file extension is
Expand All @@ -79,6 +76,17 @@ Comande line interface
--compress Save an uncompressed MuseScore file (*.mscx) as a compressed
file (*.mscz).

info:
Print informations about the score and the CLI interface itself.

-V, --version show program's version number and exit
-v, --verbose Make commands more verbose. You can specifiy multiple
arguments (. g.: -vvv) to make the command more verbose.
-k, --colorize Colorize the command line print statements.
--diff Show a diff of the XML file before and after the
manipulation.
--print-xml Print the XML markup of the score.

meta:
Deal with meta data informations stored in the MuseScore file.

Expand Down
83 changes: 47 additions & 36 deletions mscxyz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,57 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:
)
)

# output and info
###############################################################################
# groups in alphabetical order
###############################################################################

parser.add_argument(
###############################################################################
# export
###############################################################################

export_group = parser.add_argument_group(
"export", "Export the scores in different formats."
)

export_group.add_argument(
"-E",
"--export",
dest="export_extension",
choices=mscxyz.export.extensions,
metavar="<extension>",
help="Export the scores in a format defined by the extension. The exported file "
"has the same path, only the file extension is different. Further information "
"can be found at the MuseScore website: "
"https://musescore.org/en/handbook/2/file-formats, "
"https://musescore.org/en/handbook/3/file-export, "
"https://musescore.org/en/handbook/4/file-export. "
"MuseScore must be installed and the script must know the location of the "
"binary file.",
)

export_group.add_argument(
"--compress",
dest="export_compress",
action="store_true",
help="Save an uncompressed MuseScore file (*.mscx) as a compressed file (*.mscz).",
)

###############################################################################
# info
###############################################################################

info_group = parser.add_argument_group(
"info", "Print informations about the score and the CLI interface itself."
)

info_group.add_argument(
"-V",
"--version",
action="version",
version="%(prog)s {version}".format(version="0.0.0"),
)

parser.add_argument(
info_group.add_argument(
"-v",
"--verbose",
action="count",
Expand All @@ -130,58 +171,28 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:
"verbose.",
)

parser.add_argument(
info_group.add_argument(
"-k",
"--colorize",
action="store_true",
dest="general_colorize",
help="Colorize the command line print statements.",
)

parser.add_argument(
info_group.add_argument(
"--diff",
action="store_true",
dest="general_diff",
help="Show a diff of the XML file before and after the manipulation.",
)

parser.add_argument(
info_group.add_argument(
"--print-xml",
action="store_true",
dest="general_print_xml",
help="Print the XML markup of the score.",
)

###############################################################################
# groups in alphabetical order
###############################################################################

###############################################################################
# export
###############################################################################

parser.add_argument(
"-E",
"--export",
dest="export_extension",
choices=mscxyz.export.extensions,
metavar="<extension>",
help="Export the scores in a format defined by the extension. The exported file "
"has the same path, only the file extension is different. Further information "
"can be found at the MuseScore website: "
"https://musescore.org/en/handbook/2/file-formats, "
"https://musescore.org/en/handbook/3/file-export, "
"https://musescore.org/en/handbook/4/file-export. "
"MuseScore must be installed and the script must know the location of the "
"binary file.",
)

parser.add_argument(
"--compress",
dest="export_compress",
action="store_true",
help="Save an uncompressed MuseScore file (*.mscx) as a compressed file (*.mscz).",
)

###############################################################################
# meta
Expand Down

0 comments on commit 4332128

Please sign in to comment.