More documentation. Yippee

main
Michal 2 years ago
parent 1093469be7
commit 63b217056c

@ -20,7 +20,7 @@
<p align="center">Malachite is a simple yet useful workspace and local repository management tool, made for packagers of Arch Linux based distributions.</p> <p align="center">Malachite is a simple yet useful workspace and local repository management tool, made for packagers of Arch Linux based distributions.</p>
### Usage Guide ### Basic Usage Guide
| Action | Command | | Action | Command |
|--------------------------------------------------------|-------------------------------------------| |--------------------------------------------------------|-------------------------------------------|

@ -115,3 +115,4 @@ For mode-specific config, avert your eyes to the following links!
- [Workspace Mode](WORKSPACE_MODE.md) - [Workspace Mode](WORKSPACE_MODE.md)
- [Repository Mode](REPOSITORY_MODE.md) - [Repository Mode](REPOSITORY_MODE.md)
Alternatively, you can look at more [Detailed Usage](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 <package>` [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 |

@ -10,10 +10,6 @@ pub struct Args {
#[clap(long, short, global(true), action = ArgAction::SetTrue)] #[clap(long, short, global(true), action = ArgAction::SetTrue)]
pub verbose: bool, 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 /// Excludes packages from given operation, if applicable
#[clap(short = 'x', long = "exclude", action = ArgAction::Append, takes_value = true)] #[clap(short = 'x', long = "exclude", action = ArgAction::Append, takes_value = true)]
pub exclude: Vec<String>, pub exclude: Vec<String>,

@ -4,10 +4,8 @@ pub enum AppExitCode {
PkgNotFound = 3, PkgNotFound = 3,
InvalidMode = 4, InvalidMode = 4,
DirNotEmpty = 5, DirNotEmpty = 5,
RepoNotFound = 6, ConfigNotFound = 6,
ConfigNotFound = 7, NoPkgs = 7,
NoPkgs = 8, ConfigParseError = 8,
ConfigParseError = 9, InvalidRepo = 9,
NoPackagesFound = 10,
InvalidRepo = 11,
} }

@ -21,8 +21,8 @@ pub fn build(pkg: &str, sign: bool, verbose: bool) -> i32 {
// If package directory is not found, crash // If package directory is not found, crash
if !Path::exists(pkg.as_ref()) { if !Path::exists(pkg.as_ref()) {
crash!( crash!(
AppExitCode::RepoNotFound, AppExitCode::PkgNotFound,
"Repo for {} not found, aborting", "Repo for package {} not found, aborting",
pkg pkg
); );
} }

Loading…
Cancel
Save