diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index d4f1238..5b9da80 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -25,6 +25,4 @@ jobs: uses: christopherhx/gitea-upload-artifact@v4 with: name: feddy - path: | - target/release/feddy - completions.* \ No newline at end of file + path: target/release/feddy \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index a1add42..5f45ce5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -89,6 +89,15 @@ dependencies = [ "clap_derive", ] +[[package]] +name = "clap-markdown" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a2617956a06d4885b490697b5307ebb09fec10b088afc18c81762d848c2339" +dependencies = [ + "clap", +] + [[package]] name = "clap_builder" version = "4.5.37" @@ -197,6 +206,7 @@ name = "feddy" version = "0.1.0" dependencies = [ "clap", + "clap-markdown", "clap_complete", "env_logger", "log", diff --git a/Cargo.toml b/Cargo.toml index 3fd81ac..236a326 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ description = "Your awesome, friendly, lightning-fast, and super-easy-to-use Fed [dependencies] clap = { version = "4.5", features = ["derive", "env", "cargo"] } clap_complete = "4.5" +clap-markdown = "0.1" log = "0.4" env_logger = "0.11" rust-ini = "0.21" diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 0000000..ab0f2b6 --- /dev/null +++ b/DOCUMENTATION.md @@ -0,0 +1,186 @@ +# Command-Line Help for `feddy` + +This document contains the help content for the `feddy` command-line program. + +**Command Overview:** + +* [`feddy`↴](#feddy) +* [`feddy configure-dnf`↴](#feddy-configure-dnf) +* [`feddy add-repo`↴](#feddy-add-repo) +* [`feddy add-repo vscode`↴](#feddy-add-repo-vscode) +* [`feddy add-repo mullvad`↴](#feddy-add-repo-mullvad) +* [`feddy add-repo vivaldi`↴](#feddy-add-repo-vivaldi) +* [`feddy install-rpm-fusion`↴](#feddy-install-rpm-fusion) +* [`feddy configure-groups`↴](#feddy-configure-groups) +* [`feddy package`↴](#feddy-package) +* [`feddy package common-list`↴](#feddy-package-common-list) +* [`feddy package amd-list`↴](#feddy-package-amd-list) +* [`feddy package intel-list`↴](#feddy-package-intel-list) +* [`feddy package gnome-extra-list`↴](#feddy-package-gnome-extra-list) +* [`feddy package firmware-list`↴](#feddy-package-firmware-list) +* [`feddy package custom-list`↴](#feddy-package-custom-list) + +## `feddy` + +Your awesome, friendly, lightning-fast, and super-easy-to-use Fedora Buddy ! + +**Usage:** `feddy [COMMAND]` + +###### **Subcommands:** + +* `configure-dnf` — Configure dnf +* `add-repo` — Add a repository +* `install-rpm-fusion` — Install RPM fusion +* `configure-groups` — Add groups to a user +* `package` — Manage packages + + + +## `feddy configure-dnf` + +Configure dnf + +**Usage:** `feddy configure-dnf` + + + +## `feddy add-repo` + +Add a repository + +**Usage:** `feddy add-repo ` + +###### **Subcommands:** + +* `vscode` — Add VSCode repository +* `mullvad` — Add Mullvad repository +* `vivaldi` — Add Vivaldi repository + + + +## `feddy add-repo vscode` + +Add VSCode repository + +**Usage:** `feddy add-repo vscode` + + + +## `feddy add-repo mullvad` + +Add Mullvad repository + +**Usage:** `feddy add-repo mullvad` + + + +## `feddy add-repo vivaldi` + +Add Vivaldi repository + +**Usage:** `feddy add-repo vivaldi` + + + +## `feddy install-rpm-fusion` + +Install RPM fusion + +**Usage:** `feddy install-rpm-fusion` + + + +## `feddy configure-groups` + +Add groups to a user + +**Usage:** `feddy configure-groups [OPTIONS]` + +###### **Options:** + +* `-u`, `--user ` — The user to add to the groups, current user by default +* `-p`, `--print` — Print the groups without changing anything + + + +## `feddy package` + +Manage packages + +**Usage:** `feddy package [OPTIONS] ` + +###### **Subcommands:** + +* `common-list` — Install/Remove the common list +* `amd-list` — Install/Remove the AMD list +* `intel-list` — Install/Remove the Intel list +* `gnome-extra-list` — Install/Remove the Gnome extra list +* `firmware-list` — Install/Remove the firmware list +* `custom-list` — Install/Remove a custom list + +###### **Options:** + +* `-r`, `--remove` — Whenever to remove instead of install +* `-p`, `--print` — Print packages of the list without changing anything + + + +## `feddy package common-list` + +Install/Remove the common list + +**Usage:** `feddy package common-list` + + + +## `feddy package amd-list` + +Install/Remove the AMD list + +**Usage:** `feddy package amd-list` + + + +## `feddy package intel-list` + +Install/Remove the Intel list + +**Usage:** `feddy package intel-list` + + + +## `feddy package gnome-extra-list` + +Install/Remove the Gnome extra list + +**Usage:** `feddy package gnome-extra-list` + + + +## `feddy package firmware-list` + +Install/Remove the firmware list + +**Usage:** `feddy package firmware-list` + + + +## `feddy package custom-list` + +Install/Remove a custom list + +**Usage:** `feddy package custom-list --file ` + +###### **Options:** + +* `-f`, `--file ` — The file to read the list from + + + +
+ + + This document was generated automatically by + clap-markdown. + + diff --git a/Makefile b/Makefile index 255da84..4eee021 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ INSTALL_DATA ?= $(INSTALL) -m 644 build: cargo build --release + target/release/$(PROJECT) --doc > DOCUMENTATION.md format: cargo fmt --all diff --git a/README.md b/README.md index b64b90e..e7544c9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,38 @@ # feddy -Your awesome, friendly, lightning-fast, and super-easy-to-use Fedora Buddy ! \ No newline at end of file +Your awesome, friendly, lightning-fast, and super-easy-to-use Fedora Buddy ! + +## Usage + +This project is a command line tool that helps you to manage your Fedora system. You can use it to install or remove package lists, as well as to perform other post installation tasks. + +Please refer to the [DOCUMENTATION.md](DOCUMENTATION.md) file for more information on how to use the tool. + +## Install on Fedora + +Please refer to project's [releases](https://git.rawleenc.dev/rawleenc/feddy/releases), copy the RPM package link of the latest version and install it with dnf. + +## Build from source + +This is a Rust project, so you must first install [Rust](https://www.rust-lang.org/tools/install) and then run the following command to build the project: + +```bash +./configure +make +``` + +## Install from source + +You can install the project by running the following command: + +```bash +sudo make install +``` + +## Development + +You can run the project in development mode by running the following command: + +```bash +cargo run -- ${args} +``` \ No newline at end of file diff --git a/feddy.spec b/feddy.spec index 4fced2b..305bdee 100644 --- a/feddy.spec +++ b/feddy.spec @@ -25,6 +25,7 @@ Your awesome, friendly, lightning-fast, and super-easy-to-use Fedora Buddy ! %files %license LICENSE +%doc DOCUMENTATION.md %doc README.md %{_bindir}/feddy diff --git a/src/lib.rs b/src/lib.rs index def8737..b440548 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,8 +11,11 @@ pub type Result = core::result::Result>; #[derive(Parser, Debug, PartialEq)] #[command(name = crate_name!(), author = crate_authors!(), version = crate_version!(), about = crate_description!())] pub struct Cli { - #[arg(long = "generate", hide = true, value_enum)] - pub generator: Option, + #[arg(long, hide = true, value_enum)] + pub completion: Option, + + #[arg(long, hide = true)] + pub doc: bool, #[command(subcommand)] pub command: Option, diff --git a/src/main.rs b/src/main.rs index 67ab890..4832f13 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,9 +8,16 @@ fn main() { configure_logger(); let cli = Cli::parse(); + + if cli.doc { + log::info!("Generating markdown documentation..."); + clap_markdown::print_help_markdown::(); + return; + } + let mut cmd = Cli::command(); - if let Some(generator) = cli.generator { + if let Some(generator) = cli.completion { log::info!("Generating completion file for {generator:?}..."); print_completions(generator, &mut cmd); return;