diff options
Diffstat (limited to 'src/bin/ngit/cli.rs')
| -rw-r--r-- | src/bin/ngit/cli.rs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/bin/ngit/cli.rs b/src/bin/ngit/cli.rs index 60bc5d2..5461237 100644 --- a/src/bin/ngit/cli.rs +++ b/src/bin/ngit/cli.rs | |||
| @@ -13,7 +13,7 @@ use crate::sub_commands; | |||
| 13 | #[command(propagate_version = true)] | 13 | #[command(propagate_version = true)] |
| 14 | pub struct Cli { | 14 | pub struct Cli { |
| 15 | #[command(subcommand)] | 15 | #[command(subcommand)] |
| 16 | pub command: Commands, | 16 | pub command: Option<Commands>, |
| 17 | /// remote signer address | 17 | /// remote signer address |
| 18 | #[arg(long, global = true, hide = true)] | 18 | #[arg(long, global = true, hide = true)] |
| 19 | pub bunker_uri: Option<String>, | 19 | pub bunker_uri: Option<String>, |
| @@ -29,8 +29,40 @@ pub struct Cli { | |||
| 29 | /// disable spinner animations | 29 | /// disable spinner animations |
| 30 | #[arg(long, action, hide = true)] | 30 | #[arg(long, action, hide = true)] |
| 31 | pub disable_cli_spinners: bool, | 31 | pub disable_cli_spinners: bool, |
| 32 | /// show customization options via git config | ||
| 33 | #[arg(short, long, global = true)] | ||
| 34 | pub customize: bool, | ||
| 32 | } | 35 | } |
| 33 | 36 | ||
| 37 | pub const CUSTOMISE_TEMPLATE: &str = r" | ||
| 38 | ========================== | ||
| 39 | Customize ngit | ||
| 40 | ========================== | ||
| 41 | ngit settings are managed through the git config. | ||
| 42 | |||
| 43 | Currently the only settings not not reachable through standard commands relate to default hardcoded relays: | ||
| 44 | |||
| 45 | - nostr.relay-default-set - must have at least 1 value | ||
| 46 | - nostr.relay-blaster-set | ||
| 47 | - nostr.relay-signer-fallback-set | ||
| 48 | |||
| 49 | These take a string of semi-colon separated websocket URLs without spaces. For example: | ||
| 50 | `git config --global nostr.relay-default-set 'wss://relay1.example.com;wss://relay2.example.com'` | ||
| 51 | Or just for this repository: | ||
| 52 | `git config nostr.relay-default-set 'wss://relay1.example.com;wss://relay2.example.com'` | ||
| 53 | |||
| 54 | Other useful settings: | ||
| 55 | - 'nostr.nostate true' to avoid publishing a state event when pushing to a nostr remote. | ||
| 56 | - Login settings configured during `ngit account login`: | ||
| 57 | - nostr.nsec - nsec or ncryptsec | ||
| 58 | - nostr.npub - used for ncryptsec and remote signer | ||
| 59 | - nostr.bunker-uri - used for remote signer | ||
| 60 | - nostr.bunker-app-key - used for remote signer | ||
| 61 | |||
| 62 | Other config settings are applied to the local repository but just for effiency reasons eg nostr.nip05 and nostr.protocol-push | ||
| 63 | ========================== | ||
| 64 | "; | ||
| 65 | |||
| 34 | pub fn extract_signer_cli_arguments(args: &Cli) -> Result<Option<SignerInfo>> { | 66 | pub fn extract_signer_cli_arguments(args: &Cli) -> Result<Option<SignerInfo>> { |
| 35 | if let Some(nsec) = &args.nsec { | 67 | if let Some(nsec) = &args.nsec { |
| 36 | Ok(Some(SignerInfo::Nsec { | 68 | Ok(Some(SignerInfo::Nsec { |