Skip to content

Commit

Permalink
Add more argparse groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Feb 4, 2024
1 parent 4332128 commit 8cb2b0d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 35 deletions.
32 changes: 22 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,20 @@ CLI Usage
file.
--s3, --styles-v3 List all possible version 3 styles.
--s4, --styles-v4 List all possible version 4 styles.
--staff-space <dimension>
Set the staff space or spatium. This is the vertical
distance between two lines of a music staff.
--page-size <width> <height>
Set the page size.
--a4, --din-a4 Set the paper size to DIN A4 (210 by 297 mm).
--letter Set the paper size to Letter (8.5 by 11 in).
--margin <dimension> Set the top, right, bottom and left margins to the same
value.
--reset-small-staffs Reset all small staffs to normal size.

font (style):
Change the font faces of a score.

--list-fonts List all font related styles.
--text-font <font-face>
Set nearly all fonts except “romanNumeralFontFace”,
Expand All @@ -598,15 +612,10 @@ CLI Usage
“dynamicsFontFace”.
--musical-text-font <font-face>
Set “musicalTextFont”.
--staff-space <dimension>
Set the staff space or spatium. This is the vertical
distance between two lines of a music staff.
--page-size <width> <height>
Set the page size.
--a4, --din-a4 Set the paper size to DIN A4 (210 by 297 mm).
--letter Set the paper size to Letter (8.5 by 11 in).
--margin <dimension> Set the top, right, bottom and left margins to the same
value.

header (style):
Change the header.

--show-header, --no-show-header
Show or hide the header.
--header-first-page, --no-header-first-page
Expand All @@ -617,6 +626,10 @@ CLI Usage
Set the header for all pages.
--header-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different headers for odd and even pages.

footer (style):
Change the footer.

--show-footer, --no-show-footer
Show or hide the footer.
--footer-first-page, --no-footer-first-page
Expand All @@ -627,7 +640,6 @@ CLI Usage
Set the footer for all pages.
--footer-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different footers for odd and even pages.
--reset-small-staffs Reset all small staffs to normal size.

Configuration file
==================
Expand Down
32 changes: 22 additions & 10 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,20 @@ Comande line interface
file.
--s3, --styles-v3 List all possible version 3 styles.
--s4, --styles-v4 List all possible version 4 styles.
--staff-space <dimension>
Set the staff space or spatium. This is the vertical
distance between two lines of a music staff.
--page-size <width> <height>
Set the page size.
--a4, --din-a4 Set the paper size to DIN A4 (210 by 297 mm).
--letter Set the paper size to Letter (8.5 by 11 in).
--margin <dimension> Set the top, right, bottom and left margins to the same
value.
--reset-small-staffs Reset all small staffs to normal size.

font (style):
Change the font faces of a score.

--list-fonts List all font related styles.
--text-font <font-face>
Set nearly all fonts except “romanNumeralFontFace”,
Expand All @@ -206,15 +220,10 @@ Comande line interface
“dynamicsFontFace”.
--musical-text-font <font-face>
Set “musicalTextFont”.
--staff-space <dimension>
Set the staff space or spatium. This is the vertical
distance between two lines of a music staff.
--page-size <width> <height>
Set the page size.
--a4, --din-a4 Set the paper size to DIN A4 (210 by 297 mm).
--letter Set the paper size to Letter (8.5 by 11 in).
--margin <dimension> Set the top, right, bottom and left margins to the same
value.

header (style):
Change the header.

--show-header, --no-show-header
Show or hide the header.
--header-first-page, --no-header-first-page
Expand All @@ -225,6 +234,10 @@ Comande line interface
Set the header for all pages.
--header-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different headers for odd and even pages.

footer (style):
Change the footer.

--show-footer, --no-show-footer
Show or hide the footer.
--footer-first-page, --no-footer-first-page
Expand All @@ -235,5 +248,4 @@ Comande line interface
Set the footer for all pages.
--footer-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different footers for odd and even pages.
--reset-small-staffs Reset all small staffs to normal size.

38 changes: 23 additions & 15 deletions mscxyz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,37 +531,41 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:
help="List all possible version 4 styles.",
)

style_group.add_argument(
font_group = parser.add_argument_group(
"font (style)", "Change the font faces of a score."
)

font_group.add_argument(
"--list-fonts",
dest="style_list_fonts",
action="store_true",
help="List all font related styles.",
)

style_group.add_argument(
font_group.add_argument(
"--text-font",
dest="style_text_font",
metavar="<font-face>",
help="Set nearly all fonts except “romanNumeralFontFace”, “figuredBassFontFace”, "
"“dynamicsFontFace“, “musicalSymbolFont” and “musicalTextFont”.",
)

style_group.add_argument(
font_group.add_argument(
"--title-font",
dest="style_title_font",
metavar="<font-face>",
help="Set “titleFontFace” and “subTitleFontFace”.",
)

style_group.add_argument(
font_group.add_argument(
"--musical-symbol-font",
dest="style_musical_symbol_font",
choices=musical_symbol_font_faces,
metavar="<font-face>",
help="Set “musicalSymbolFont”, “dynamicsFont” and “dynamicsFontFace”.",
)

style_group.add_argument(
font_group.add_argument(
"--musical-text-font",
dest="style_musical_text_font",
choices=musical_text_font_faces,
Expand Down Expand Up @@ -610,36 +614,38 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:

# header

style_group.add_argument(
header_group = parser.add_argument_group("header (style)", "Change the header.")

header_group.add_argument(
"--show-header",
dest="style_show_header",
action=argparse.BooleanOptionalAction,
help="Show or hide the header.",
)

style_group.add_argument(
header_group.add_argument(
"--header-first-page",
dest="style_header_first_page",
action=argparse.BooleanOptionalAction,
help="Show the header on the first page.",
)

style_group.add_argument(
header_group.add_argument(
"--different-odd-even-header",
dest="style_different_odd_even_header",
action=argparse.BooleanOptionalAction,
help="Use different header for odd and even pages.",
)

style_group.add_argument(
header_group.add_argument(
"--header",
nargs=3,
dest="style_header_all",
metavar=("<left>", "<center>", "<right>"),
help="Set the header for all pages.",
)

style_group.add_argument(
header_group.add_argument(
"--header-odd-even",
nargs=6,
dest="style_header_odd_even",
Expand All @@ -656,36 +662,38 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:

# footer

style_group.add_argument(
footer_group = parser.add_argument_group("footer (style)", "Change the footer.")

footer_group.add_argument(
"--show-footer",
dest="style_show_footer",
action=argparse.BooleanOptionalAction,
help="Show or hide the footer.",
)

style_group.add_argument(
footer_group.add_argument(
"--footer-first-page",
dest="style_footer_first_page",
action=argparse.BooleanOptionalAction,
help="Show the footer on the first page.",
)

style_group.add_argument(
footer_group.add_argument(
"--different-odd-even-footer",
dest="style_different_odd_even_footer",
action=argparse.BooleanOptionalAction,
help="Use different footers for odd and even pages.",
)

style_group.add_argument(
footer_group.add_argument(
"--footer",
nargs=3,
dest="style_footer_all",
metavar=("<left>", "<center>", "<right>"),
help="Set the footer for all pages.",
)

style_group.add_argument(
footer_group.add_argument(
"--footer-odd-even",
nargs=6,
dest="style_footer_odd_even",
Expand Down

0 comments on commit 8cb2b0d

Please sign in to comment.