Skip to content

Commit

Permalink
Document autocomplete support
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Jan 9, 2024
1 parent c9f8fc5 commit 866ce8a
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 12 deletions.
27 changes: 22 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Installation
How to ...
==========

... specify the MuseScore files to work on.
... specify the MuseScore files to work on?
-------------------------------------------

To find out which files are selected by the script, the ``-L, --list-files``
Expand Down Expand Up @@ -78,16 +78,33 @@ To apply glob patterns on the file paths, the ``--glob`` option can be used.
To selection only *mscz* oder *mscx* files use the options ``--mscz`` or ``--mscx``.
Don’t mix the options ``--mscz`` and ``--mscx`` with the option ``--glob``.

... enable autocomplete support?
--------------------------------

Use one of the following autocomplete files ...

* `bash <https://github.com/Josef-Friedrich/mscxyz/blob/main/autocomplete.bash>`_.
* `zsh <https://github.com/Josef-Friedrich/mscxyz/blob/main/autocomplete.zsh>`_.
* `tcsh <https://github.com/Josef-Friedrich/mscxyz/blob/main/autocomplete.tcsh>`_.

... or generate the autocomplete files by yourself:

::

musescore-manager --print-completion bash > autocomplete.bash
musescore-manager --print-completion zsh > autocomplete.zsh
musescore-manager --print-completion tcsh > autocomplete.tcsh

CLI Usage
=========

::

usage: musescore-manager [-h] [--print-completion {bash,zsh,tcsh}] [-V] [-b]
[-k] [-C GENERAL_CONFIG_FILE] [-d] [-m] [--diff]
[-e FILE_PATH] [-v] [-E EXPORT_EXTENSION]
[-c META_CLEAN] [-D] [-i SOURCE_FIELDS FORMAT_STRING]
[-j] [-l DESTINATION FORMAT_STRING] [-y]
[-e FILE_PATH] [-v] [-E <extension>] [-c META_CLEAN]
[-D] [-i SOURCE_FIELDS FORMAT_STRING] [-j]
[-l DESTINATION FORMAT_STRING] [-y]
[-S DESTINATION_FIELD FORMAT_STRING]
[-x LYRICS_EXTRACT] [-r LYRICS_REMAP] [-F]
[-f RENAME_FORMAT] [-A] [-a] [-n] [-K FIELDS]
Expand Down Expand Up @@ -137,7 +154,7 @@ CLI Usage
- https://musescore.org/en/handbook/3/file-export
- https://musescore.org/en/handbook/4/file-export

-E EXPORT_EXTENSION, --extension EXPORT_EXTENSION
-E <extension>, --extension <extension>
Extension to export. If this option is omitted, then the
default extension is "pdf".

Expand Down
21 changes: 19 additions & 2 deletions README_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ Installation
How to ...
==========

... specify the MuseScore files to work on.
... specify the MuseScore files to work on?
-------------------------------------------


To find out which files are selected by the script, the ``-L, --list-files``
option can be used. The ``--list-files`` option lists as the name suggests
only the file paths and doesn’t touch the specified *MuseScore* files:
Expand Down Expand Up @@ -76,6 +75,24 @@ To apply glob patterns on the file paths, the ``--glob`` option can be used.
To selection only *mscz* oder *mscx* files use the options ``--mscz`` or ``--mscx``.
Don’t mix the options ``--mscz`` and ``--mscx`` with the option ``--glob``.


... enable autocomplete support?
--------------------------------

Use one of the following autocomplete files ...

* `bash <https://github.com/Josef-Friedrich/mscxyz/blob/main/autocomplete.bash>`_.
* `zsh <https://github.com/Josef-Friedrich/mscxyz/blob/main/autocomplete.zsh>`_.
* `tcsh <https://github.com/Josef-Friedrich/mscxyz/blob/main/autocomplete.tcsh>`_.

... or generate the autocomplete files by yourself:

::

musescore-manager --print-completion bash > autocomplete.bash
musescore-manager --print-completion zsh > autocomplete.zsh
musescore-manager --print-completion tcsh > autocomplete.tcsh

CLI Usage
=========

Expand Down
8 changes: 4 additions & 4 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Comande line interface

usage: musescore-manager [-h] [--print-completion {bash,zsh,tcsh}] [-V] [-b]
[-k] [-C GENERAL_CONFIG_FILE] [-d] [-m] [--diff]
[-e FILE_PATH] [-v] [-E EXPORT_EXTENSION]
[-c META_CLEAN] [-D] [-i SOURCE_FIELDS FORMAT_STRING]
[-j] [-l DESTINATION FORMAT_STRING] [-y]
[-e FILE_PATH] [-v] [-E <extension>] [-c META_CLEAN]
[-D] [-i SOURCE_FIELDS FORMAT_STRING] [-j]
[-l DESTINATION FORMAT_STRING] [-y]
[-S DESTINATION_FIELD FORMAT_STRING]
[-x LYRICS_EXTRACT] [-r LYRICS_REMAP] [-F]
[-f RENAME_FORMAT] [-A] [-a] [-n] [-K FIELDS]
Expand Down Expand Up @@ -58,7 +58,7 @@ Comande line interface
- https://musescore.org/en/handbook/3/file-export
- https://musescore.org/en/handbook/4/file-export

-E EXPORT_EXTENSION, --extension EXPORT_EXTENSION
-E <extension>, --extension <extension>
Extension to export. If this option is omitted, then the
default extension is "pdf".

Expand Down
2 changes: 1 addition & 1 deletion mscxyz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import shtab
import tmep

from mscxyz import utils
import mscxyz.export
from mscxyz import utils
from mscxyz.meta import Interface, InterfaceReadWrite
from mscxyz.score import Score
from mscxyz.settings import parse_args
Expand Down
17 changes: 17 additions & 0 deletions tests/test_how_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,20 @@ def test_dont_mix_mscx_and_glob(self) -> None:
assert "--glob: not allowed with argument --mscx" in sysexit(
"-L", "--mscx", "-glob", "*"
)


class TestAutocomplete:
def test_bash(self) -> None:
assert "# AUTOMATICALLY GENERATED by `shtab`" in sysexit(
"--print-completion", "bash"
)

def test_zsh(self) -> None:
assert "# AUTOMATICALLY GENERATED by `shtab`" in sysexit(
"--print-completion", "zsh"
)

def test_tcsh(self) -> None:
assert "# AUTOMATICALLY GENERATED by `shtab`" in sysexit(
"--print-completion", "tcsh"
)

0 comments on commit 866ce8a

Please sign in to comment.