From a08b80c06439ff8576a62e10dd79cfde21f654ce Mon Sep 17 00:00:00 2001 From: Michal Date: Sat, 23 Jul 2022 02:50:44 +0100 Subject: [PATCH] More documentation. Yippee --- README.md | 2 +- docs/COMMON_FEATURES.md | 1 + docs/USAGE.md | 37 +++++++++++++++++++++++++++++++++++++ src/args.rs | 4 ---- src/internal/exit_codes.rs | 10 ++++------ src/repository/package.rs | 4 ++-- 6 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 docs/USAGE.md diff --git a/README.md b/README.md index 3222526..ee71539 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@

Malachite is a simple yet useful workspace and local repository management tool, made for packagers of Arch Linux based distributions.

-### Usage Guide +### Basic Usage Guide | Action | Command | |--------------------------------------------------------|-------------------------------------------| diff --git a/docs/COMMON_FEATURES.md b/docs/COMMON_FEATURES.md index f1de5b4..94f72b5 100644 --- a/docs/COMMON_FEATURES.md +++ b/docs/COMMON_FEATURES.md @@ -115,3 +115,4 @@ For mode-specific config, avert your eyes to the following links! - [Workspace Mode](WORKSPACE_MODE.md) - [Repository Mode](REPOSITORY_MODE.md) +Alternatively, you can look at more [Detailed Usage](USAGE.md) diff --git a/docs/USAGE.md b/docs/USAGE.md new file mode 100644 index 0000000..0a11bcf --- /dev/null +++ b/docs/USAGE.md @@ -0,0 +1,37 @@ +# Detailed Usage +Work it harder, make it better! + +### Global Flags + +| Flag | Description | +|-------------------|----------------------------------------------------------------------------------------------------------------------------------------| +| `--verbose`, `-v` | Prints lots of debug information to `stderr`. If something doesn't go right, sending us the output with this enabled will help greatly | +| `--exclude`, `-x` | Excludes the supplied package from the current operation. Can be used multiple times. | + +### Basic Commands + +| Action | Command | Extra Flags | +|--------------------------------------------------------|-------------------------------------------|------------------------------------------------------------------------------------------------------------------| +| Build a package/packages. | `mlc build ` [all if left empty] | `--no-regen`: Doesn't regenerate repository after build | +| Generate pacman repository | `mlc repo-gen` | | +| Update local repos/PKGBUILDs | `mlc pull/update` [all if left empty] | `--no-regen`: If `mode.repository.build_on_update` is `true`, Do not regenerate repository after package rebuild | +| Create and/or open config file | `mlc conf` | | +| Initialises repo/workspace based on config in mlc.toml | `mlc clone/init` | | + +### Exit Codes + +| AppExitCode (named Enum) | Exit code (i32) | Error Description | +|--------------------------|-----------------|--------------------------------------------------------------------------------------------------------| +| `RunAsRoot` | `1` | Malachite was ran as root. This is highly discouraged. So highly, in fact, that it will refuse to run. | +| `BuildInWorkspace` | `2` | Malachite was ran in Workspace mode, but a Repository-mode-specific operation was supplied | +| `PkgNotFound` | `3` | A build was attempted for a package that does not exist | +| `InvalidMode` | `4` | Malachite was launched in a mode other than `workspace` or `repository` | +| `DirNotEmpty` | `5` | The creation of a Malachite repository was attempted in a non-empty directory | +| `ConfigNotFound` | `6` | The default config file (`./mlc.toml`) was not found | +| `NoPkgs` | `7` | Somehow, no packages were supplied to/found in the relevant operation | +| `ConfigParseError` | `8` | The config file could not be parsed | +| `InvalidRepo` | `9` | The generated repository somehow contains no packages | + + + + diff --git a/src/args.rs b/src/args.rs index 0f9f9e2..14f7394 100644 --- a/src/args.rs +++ b/src/args.rs @@ -10,10 +10,6 @@ pub struct Args { #[clap(long, short, global(true), action = ArgAction::SetTrue)] pub verbose: bool, - /// Complete operations without prompting user - #[clap(long = "noconfirm", global(true), action = ArgAction::SetTrue)] - pub no_confirm: bool, - /// Excludes packages from given operation, if applicable #[clap(short = 'x', long = "exclude", action = ArgAction::Append, takes_value = true)] pub exclude: Vec, diff --git a/src/internal/exit_codes.rs b/src/internal/exit_codes.rs index 7ed8aff..f50199f 100644 --- a/src/internal/exit_codes.rs +++ b/src/internal/exit_codes.rs @@ -4,10 +4,8 @@ pub enum AppExitCode { PkgNotFound = 3, InvalidMode = 4, DirNotEmpty = 5, - RepoNotFound = 6, - ConfigNotFound = 7, - NoPkgs = 8, - ConfigParseError = 9, - NoPackagesFound = 10, - InvalidRepo = 11, + ConfigNotFound = 6, + NoPkgs = 7, + ConfigParseError = 8, + InvalidRepo = 9, } diff --git a/src/repository/package.rs b/src/repository/package.rs index e8ac524..c363a71 100755 --- a/src/repository/package.rs +++ b/src/repository/package.rs @@ -21,8 +21,8 @@ pub fn build(pkg: &str, sign: bool, verbose: bool) -> i32 { // If package directory is not found, crash if !Path::exists(pkg.as_ref()) { crash!( - AppExitCode::RepoNotFound, - "Repo for {} not found, aborting", + AppExitCode::PkgNotFound, + "Repo for package {} not found, aborting", pkg ); }