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[source]

Bases: ly.cli.command._edit_command

convert absolute music to relative

run(opts, cursor, output)[source]
class ly.cli.command.highlight(output=None)[source]

Bases: ly.cli.command._export_command

write syntax colored HTML.

run(opts, cursor, output)[source]
ly.cli.command.hl

alias of ly.cli.command.highlight

class ly.cli.command.indent[source]

Bases: ly.cli.command._edit_command

run the indenter

indenter(opts)[source]

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

run(opts, cursor, output)[source]
class ly.cli.command.language[source]

Bases: ly.cli.command._info_command

print language to stdout

get_info(info)[source]
class ly.cli.command.mode[source]

Bases: ly.cli.command._info_command

print mode to stdout

get_info(info)[source]
class ly.cli.command.musicxml(output=None)[source]

Bases: ly.cli.command._export_command

run(opts, cursor, output)[source]
class ly.cli.command.reformat[source]

Bases: ly.cli.command.indent

reformat the document

run(opts, cursor, output)[source]
class ly.cli.command.rel2abs[source]

Bases: ly.cli.command._edit_command

convert relative music to absolute

run(opts, cursor, output)[source]
class ly.cli.command.set_variable(arg)[source]

Bases: ly.cli.command._command

set a variable to a value

run(opts, cursor, output)[source]
class ly.cli.command.simplify_accidentals[source]

Bases: ly.cli.command._edit_command

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

run(opts, cursor, output)[source]
class ly.cli.command.translate(language)[source]

Bases: ly.cli.command._edit_command

translate pitch names

run(opts, cursor, output)[source]
class ly.cli.command.transpose(arg)[source]

Bases: ly.cli.command._edit_command

transpose music

run(opts, cursor, output)[source]
class ly.cli.command.version[source]

Bases: ly.cli.command._info_command

print version to stdout

get_info(info)[source]
class ly.cli.command.write(output=None)[source]

Bases: ly.cli.command._command

write the source file.

run(opts, cursor, output)[source]

ly.cli.main module

The entry point for the ‘ly’ command.

class ly.cli.main.Options[source]

Bases: object

Store all the startup options and their defaults.

set_variable(name, value)[source]
class ly.cli.main.Output[source]

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(**kwds)[source]

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)[source]

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)[source]

Exit with message to STDERR.

ly.cli.main.load(filename, encoding, mode)[source]

Load a file, returning a ly.document.Document

ly.cli.main.main()[source]
ly.cli.main.parse_command(arg)[source]

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

Exits when a command is invalid.

ly.cli.main.parse_command_line()[source]

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()[source]

Print usage info.

ly.cli.main.usage_short()[source]

Print short usage info.

ly.cli.main.version()[source]

Print version info.