# ly.cli package

## Module contents

The commandline interface of the ‘ly’ command.

## Submodules

## ly.cli.command module

The commands that are available to the command line.

class `ly.cli.command.``abs2rel`

  Bases: `ly.cli.command._edit_command`

  convert absolute music to relative

  `run`(opts, cursor, output)

class `ly.cli.command.``highlight`(output=None)

  Bases: `ly.cli.command._export_command`

  write syntax colored HTML.

  `run`(opts, cursor, output)

`ly.cli.command.``hl`

  alias of `ly.cli.command.highlight`

class `ly.cli.command.``indent`

  Bases: `ly.cli.command._edit_command`

  run the indenter

  `indenter`(opts)

    Get a ly.indent.Indenter initialized with our options.

  `run`(opts, cursor, output)

class `ly.cli.command.``language`

  Bases: `ly.cli.command._info_command`

  print language to stdout

  `get_info`(info)

    Should return the desired information from the docinfo object.

    If it returns None or an empty string, nothing is printed.

class `ly.cli.command.``mode`

  Bases: `ly.cli.command._info_command`

  print mode to stdout

  `get_info`(info)

    Should return the desired information from the docinfo object.

    If it returns None or an empty string, nothing is printed.

class `ly.cli.command.``musicxml`(output=None)

  Bases: `ly.cli.command._export_command`

  `run`(opts, cursor, output)

class `ly.cli.command.``reformat`

  Bases: `ly.cli.command.indent`

  reformat the document

  `run`(opts, cursor, output)

class `ly.cli.command.``rel2abs`

  Bases: `ly.cli.command._edit_command`

  convert relative music to absolute

  `run`(opts, cursor, output)

class `ly.cli.command.``set_variable`(arg)

  Bases: `ly.cli.command._command`

  set a variable to a value

  `run`(opts, cursor, output)

class `ly.cli.command.``simplify_accidentals`

  Bases: `ly.cli.command._edit_command`

  replace notes with accidentals as much as possible with their natural neighbors

  `run`(opts, cursor, output)

class `ly.cli.command.``translate`(language)

  Bases: `ly.cli.command._edit_command`

  translate pitch names

  `run`(opts, cursor, output)

class `ly.cli.command.``transpose`(arg)

  Bases: `ly.cli.command._edit_command`

  transpose music

  `run`(opts, cursor, output)

class `ly.cli.command.``version`

  Bases: `ly.cli.command._info_command`

  print version to stdout

  `get_info`(info)

    Should return the desired information from the docinfo object.

    If it returns None or an empty string, nothing is printed.

class `ly.cli.command.``write`(output=None)

  Bases: `ly.cli.command._command`

  write the source file.

  `run`(opts, cursor, output)

## ly.cli.main module

The entry point for the ‘ly’ command.

class `ly.cli.main.``Options`

  Bases: `object`

  Store all the startup options and their defaults.

  `set_variable`(name, value)

class `ly.cli.main.``Output`

  Bases: `object`

  Object living for a whole file/command operation, handling the output.

  When opening a file it has already opened earlier, the file is appended to (like awk).

  `file`(opts, filename, encoding)

    Return a context manager for writing to.

    If you set encoding to “binary” or False, the file is opened in binary mode and you should encode the data you write yourself.

  `get_filename`(opts, filename)

    Queries the output attribute from the Options and returns it.

    If replace_pattern is True (by default) and the attribute contains a ‘*’, it is replaced with the full path of the specified filename, but without extension. It the attribute contains a ‘?’, it is replaced with the filename without path and extension.

    If ‘-‘ is returned, it denotes standard output.

`ly.cli.main.``die`(message)

  Exit with message to STDERR.

`ly.cli.main.``load`(filename, encoding, mode)

  Load a file, returning a ly.document.Document

`ly.cli.main.``main`()

`ly.cli.main.``parse_command`(arg)

  Parse the command string, returning a list of command.command instances.

  Exits when a command is invalid.

`ly.cli.main.``parse_command_line`()

  Return a three-tuple(options, commands, files).

  options is an Options instance with all the command-line options commands is a list of command.command instances files is the list of filename arguments

  Also performs error handling and may exit on certain circumstances.

`ly.cli.main.``usage`()

  Print usage info.

`ly.cli.main.``usage_short`()

  Print short usage info.

`ly.cli.main.``version`()

  Print version info.