Skip to content

Implement command line parsing #41

Description

@jcouball

Implement the command line parsing in chezroot to satisfy these requirements:

The purpose of chezroot is to call chezmoi via sudo when appropriate, passing its command line arguments directly to chezmoi (with some exceptions). Calling via sudo or non-sudo is based on the command given by the user on the command line.

  • chezroot will need to be able to determine the "command line items" given by the user: global flags, command, subcommand, and command specific options and flags, etc.

  • For most commands, chezroot will call chezmoi with all the arguments it received in a spawned subprocess. stdout, stderr, and the process status returned from chezmoi should be returned by chezroot

  • chezroot will need to add some global options to the chezmoi command line. For instance, --destination DIRECTORY and --source DIRECTORY.

  • Certain command line items will be disallowed by chezroot. In this case, chezroot will display an error instead of calling chezmoi. For instance, the --destination, --source, and --config global options are not allowed. And the --apply and --watch options to the edit command are not allowed.

  • Certain global flags that chezroot will need to filter out for itself and not pass to chezmoi. For instance, the global flag --profile=NAME will be removed from the command line passed on to chezmoi. chezroot will need to use the given NAME.

  • chezroot will need to intercept some commands to wrap their functionality (do something before and/or after the chezmoi command is called) or do something totally different without calling chezmoi at all

  • chezroot will add certain commands that it will implement and not pass on to chezmoi. An example of this is the profile management command as described in this repository's README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions