# lesana.command module

class lesana.command.Command(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  add_arguments(parser: ArgumentParser)

    Add argparse arguments to an existing parser.

    Override this method to add arguments to a subcommand.

class lesana.command.Edit(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`, `ExternalEditorMixin`

  Edit a lesana entry

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--no-git'], {'action': 'store_false', 'dest': 'git', 'help': "Don't add the new entry to git"}), (['eid'], {'help': 'eid of an entry to edit'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

class lesana.command.Export(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  Export entries to a different collection

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--query', '-q'], {'help': 'Xapian query to search in the collection'}), (['destination'], {'help': 'The collection to export entries to'}), (['template'], {'help': 'Template to convert entries'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

class lesana.command.GetValues(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  List all values for one field, with entry counts.

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--field', '-f'], {'help': 'Name of the field', 'required': True}), (['--template', '-t'], {'help': 'Template to use when displaying results'}), (['query'], {'default': '*', 'help': 'Xapian query to limit the count search " + "in the collection', 'nargs': '*'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

  name: Optional[str] = 'get-values'

    The name used to call this subcommand from the command line.

    If this property is none, the default is the name of the class set to lowercase.

class lesana.command.Index(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  Index entries in a lesana collection

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--reset'], {'action': 'store_true', 'help': 'Delete the existing index and reindex from scratch.'}), (['files'], {'default': None, 'help': 'List of files to index (default: everything)', 'nargs': '*'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

class lesana.command.Init(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`, `ExternalEditorMixin`

  Initialize a lesana collection

  arguments = [(['--collection', '-c'], {'default': '.', 'help': 'The directory to work on (default .)'}), (['--no-git'], {'action': 'store_false', 'dest': 'git', 'help': 'Skip setting up git in this directory'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

class lesana.command.Lesana

  Bases: `MainCommand`

  Manage collections

  commands: Iterable['Command'] = (<lesana.command.New object>, <lesana.command.Edit object>, <lesana.command.Show object>, <lesana.command.Index object>, <lesana.command.Search object>, <lesana.command.GetValues object>, <lesana.command.Update object>, <lesana.command.Export object>, <lesana.command.Init object>, <lesana.command.Remove object>)

    The subcommands: a tuple of `Command` subclasses.

class lesana.command.New(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`, `ExternalEditorMixin`

  Create a new entry

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--no-git'], {'action': 'store_false', 'dest': 'git', 'help': "Don't add the new entry to git"})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

class lesana.command.Remove(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  Remove an entry from a collection

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['entries'], {'help': 'List of entries to remove', 'nargs': '+'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

  name: Optional[str] = 'rm'

    The name used to call this subcommand from the command line.

    If this property is none, the default is the name of the class set to lowercase.

class lesana.command.Search(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  Search for entries

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--template', '-t'], {'help': 'Template to use when displaying results'}), (['--offset'], {'type': <class 'int'>}), (['--pagesize'], {'type': <class 'int'>}), (['--all'], {'action': 'store_true', 'help': 'Return all available results'}), (['--sort'], {'action': 'append', 'help': 'Sort results by a sortable field'}), (['--expand-query-template', '-e'], {'action': 'store_true', 'help': 'Render search_aliases in the query as a jinja2 template'}), (['query'], {'default': '*', 'help': 'Xapian query to search in the collection', 'nargs': '*'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

class lesana.command.Show(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  Show a lesana entry

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--template', '-t'], {'help': 'Use the specified template to display results.'}), (['eid'], {'help': 'eid of an entry to edit'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

class lesana.command.Update(collection_class=<class 'lesana.collection.Collection'>, entry_class=<class 'lesana.collection.Entry'>)

  Bases: `Command`

  Update a field in multiple entries

  arguments = [(['--collection', '-c'], {'help': 'The collection to work on (default .)'}), (['--field', '-f'], {'help': 'The field to change'}), (['--value', '-t'], {'help': 'The value to set'}), (['query'], {'help': 'Xapian query to search in the collection', 'nargs': '+'})]
  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

lesana.command.main()