diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-17 14:45:09 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-17 15:09:04 +0000 |
| commit | 62cc73b9c749e1aca758a83c6263d6d5cd18527d (patch) | |
| tree | c891733f79b1b067a95b44c1385d855fbcd05d5c /src/bin/ngit/cli.rs | |
| parent | 972e22060e4a0a8be9f99f0ef50a95b23350dfb1 (diff) | |
improve CLI help text and subcommand descriptions
- mention remote helper in main help so users know native git commands work
- fix inconsistent indentation in main help template
- update init about to lead with 'publish a repository'
- add 'create' to account subcommand about
- add long_about to send referencing simpler pr/ push flow
- update list about to remove legacy interactive-mode language
- add long_about to checkout/apply pointing to ngit list
Diffstat (limited to 'src/bin/ngit/cli.rs')
| -rw-r--r-- | src/bin/ngit/cli.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/bin/ngit/cli.rs b/src/bin/ngit/cli.rs index ade7861..7baa1d3 100644 --- a/src/bin/ngit/cli.rs +++ b/src/bin/ngit/cli.rs | |||
| @@ -8,7 +8,7 @@ use crate::sub_commands; | |||
| 8 | #[command( | 8 | #[command( |
| 9 | author, | 9 | author, |
| 10 | version, | 10 | version, |
| 11 | help_template = "{name} {version}\nnostr plugin for git\n - clone a nostr repository, or add as a remote, by using the url format nostr://npub123/identifier\n - remote branches beginning with `pr/` are open PRs from contributors; `ngit list` can be used to view all PRs\n - to open a PR, push a branch with the prefix `pr/` or use `ngit send` for advanced options\n set title and description via push options:\n git push -o 'title=My PR' -o 'description=line1\\n\\nline2' -u origin pr/branch\n- publish a repository to nostr with `ngit init`\n\n{usage}\n{all-args}" | 11 | help_template = "{name} {version}\nnostr plugin for git\n includes a remote helper so native git commands (clone, fetch, push) work with nostr:// URLs\n - clone a nostr repository, or add as a remote, by using the url format nostr://npub123/identifier\n - remote branches beginning with `pr/` are open PRs from contributors; `ngit list` can be used to view all PRs\n - to open a PR, push a branch with the prefix `pr/` or use `ngit send` for advanced options\n set title and description via push options:\n git push -o 'title=My PR' -o 'description=line1\\n\\nline2' -u origin pr/branch\n - publish a repository to nostr with `ngit init`\n\n{usage}\n{all-args}" |
| 12 | )] | 12 | )] |
| 13 | #[command(propagate_version = true)] | 13 | #[command(propagate_version = true)] |
| 14 | #[allow(clippy::struct_excessive_bools)] | 14 | #[allow(clippy::struct_excessive_bools)] |
| @@ -103,11 +103,15 @@ pub fn extract_signer_cli_arguments(args: &Cli) -> Result<Option<SignerInfo>> { | |||
| 103 | 103 | ||
| 104 | #[derive(Subcommand)] | 104 | #[derive(Subcommand)] |
| 105 | pub enum Commands { | 105 | pub enum Commands { |
| 106 | /// signal you are this repo's maintainer accepting PRs and issues via nostr | 106 | /// publish a repository to nostr; signal you are its maintainer accepting |
| 107 | /// PRs and issues | ||
| 107 | Init(sub_commands::init::SubCommandArgs), | 108 | Init(sub_commands::init::SubCommandArgs), |
| 108 | /// submit PR with advanced options | 109 | /// submit PR with advanced options |
| 110 | #[command( | ||
| 111 | long_about = "submit PR with advanced options\n\nfor a simpler flow, push a branch with the `pr/` prefix using native git:\n git push -o 'title=My PR' -o 'description=details here' -u origin pr/my-branch" | ||
| 112 | )] | ||
| 109 | Send(sub_commands::send::SubCommandArgs), | 113 | Send(sub_commands::send::SubCommandArgs), |
| 110 | /// list PRs; checkout, apply or download selected | 114 | /// list PRs and view details |
| 111 | List { | 115 | List { |
| 112 | /// Filter by status (comma-separated: open,draft,closed,applied) | 116 | /// Filter by status (comma-separated: open,draft,closed,applied) |
| 113 | #[arg(long, default_value = "open,draft")] | 117 | #[arg(long, default_value = "open,draft")] |
| @@ -122,6 +126,9 @@ pub enum Commands { | |||
| 122 | offline: bool, | 126 | offline: bool, |
| 123 | }, | 127 | }, |
| 124 | /// checkout a proposal branch by event-id or nevent | 128 | /// checkout a proposal branch by event-id or nevent |
| 129 | #[command( | ||
| 130 | long_about = "checkout a proposal branch by event-id or nevent\n\nuse `ngit list` to find proposal IDs" | ||
| 131 | )] | ||
| 125 | Checkout { | 132 | Checkout { |
| 126 | /// Proposal event-id (hex) or nevent (bech32) | 133 | /// Proposal event-id (hex) or nevent (bech32) |
| 127 | id: String, | 134 | id: String, |
| @@ -130,6 +137,9 @@ pub enum Commands { | |||
| 130 | offline: bool, | 137 | offline: bool, |
| 131 | }, | 138 | }, |
| 132 | /// apply proposal patches to current branch | 139 | /// apply proposal patches to current branch |
| 140 | #[command( | ||
| 141 | long_about = "apply proposal patches to current branch\n\nuse `ngit list` to find proposal IDs" | ||
| 142 | )] | ||
| 133 | Apply { | 143 | Apply { |
| 134 | /// Proposal event-id or nevent | 144 | /// Proposal event-id or nevent |
| 135 | id: String, | 145 | id: String, |
| @@ -143,7 +153,7 @@ pub enum Commands { | |||
| 143 | /// update repo git servers to reflect nostr state (add, update or delete | 153 | /// update repo git servers to reflect nostr state (add, update or delete |
| 144 | /// remote refs) | 154 | /// remote refs) |
| 145 | Sync(sub_commands::sync::SubCommandArgs), | 155 | Sync(sub_commands::sync::SubCommandArgs), |
| 146 | /// login, logout or export keys | 156 | /// create account, login, logout or export keys |
| 147 | Account(AccountSubCommandArgs), | 157 | Account(AccountSubCommandArgs), |
| 148 | } | 158 | } |
| 149 | 159 | ||