diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-27 17:05:19 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-27 17:05:19 +0000 |
| commit | 5478aa74cc26452809e499a461067ca9744cb7ce (patch) | |
| tree | 5c30d8b343ea3db421287451d9b4162340e5451c /src/bin/ngit/sub_commands/init.rs | |
| parent | 469787a93c6732706e040d82bb28d869afc49f20 (diff) | |
fix:(init): show guidance when cli arg not used
instead of all the time. this also fixes the tests.
Diffstat (limited to 'src/bin/ngit/sub_commands/init.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index acc86fa..2af6aef 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -256,29 +256,28 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 256 | } | 256 | } |
| 257 | }; | 257 | }; |
| 258 | 258 | ||
| 259 | let no_state = if let Ok(Some(s)) = git_repo.get_git_config_item("nostr.nostate", None) { | 259 | let git_server = if args.clone_url.is_empty() { |
| 260 | s == "true" | 260 | let no_state = if let Ok(Some(s)) = git_repo.get_git_config_item("nostr.nostate", None) { |
| 261 | } else { | 261 | s == "true" |
| 262 | false | 262 | } else { |
| 263 | }; | 263 | false |
| 264 | if no_state { | 264 | }; |
| 265 | if no_state { | ||
| 266 | println!( | ||
| 267 | "you have opted out of storing git state on nostr, so a git server must be used for the state of authoritative branches, tags and related git objects." | ||
| 268 | ); | ||
| 269 | } else { | ||
| 270 | println!( | ||
| 271 | "your repository state will be stored on nostr, but a git server is still required to store the git objects associated with this state." | ||
| 272 | ); | ||
| 273 | } | ||
| 265 | println!( | 274 | println!( |
| 266 | "you have opted out of storing git state on nostr, so a git server must be used for the state of authoritative branches, tags and related git objects." | 275 | "you can change this git server at any time and even configure multiple servers for redundancy. In this case, the git plugin will push to all of them when using the nostr remote." |
| 267 | ); | 276 | ); |
| 268 | } else { | 277 | println!("only maintainers need write access as PRs are sent over nostr."); |
| 269 | println!( | 278 | println!( |
| 270 | "your repository state will be stored on nostr, but a git server is still required to store the git objects associated with this state." | 279 | "a lightweight git server implementation for use with nostr, requiring no signup, is in development. several providers have shown interest in hosting it. for now use github, codeberg, or self-hosted song, forge, etc." |
| 271 | ); | 280 | ); |
| 272 | } | ||
| 273 | println!( | ||
| 274 | "you can change this git server at any time and even configure multiple servers for redundancy. In this case, the git plugin will push to all of them when using the nostr remote." | ||
| 275 | ); | ||
| 276 | println!("only maintainers need write access as PRs are sent over nostr."); | ||
| 277 | println!( | ||
| 278 | "a lightweight git server implementation for use with nostr, requiring no signup, is in development. several providers have shown interest in hosting it. for now use github, codeberg, or self-hosted song, forge, etc." | ||
| 279 | ); | ||
| 280 | |||
| 281 | let git_server = if args.clone_url.is_empty() { | ||
| 282 | Interactor::default() | 281 | Interactor::default() |
| 283 | .input( | 282 | .input( |
| 284 | PromptInputParms::default() | 283 | PromptInputParms::default() |
| @@ -344,9 +343,6 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 344 | args.relays.clone() | 343 | args.relays.clone() |
| 345 | }; | 344 | }; |
| 346 | 345 | ||
| 347 | println!( | ||
| 348 | "the earliest unique commit helps with discoverability. It defaults to the root commit. Only change this if your repo has completely forked off an has formed its own identity." | ||
| 349 | ); | ||
| 350 | let earliest_unique_commit = match &args.earliest_unique_commit { | 346 | let earliest_unique_commit = match &args.earliest_unique_commit { |
| 351 | Some(t) => t.clone(), | 347 | Some(t) => t.clone(), |
| 352 | None => { | 348 | None => { |
| @@ -355,6 +351,9 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 355 | } else { | 351 | } else { |
| 356 | root_commit.to_string() | 352 | root_commit.to_string() |
| 357 | }; | 353 | }; |
| 354 | println!( | ||
| 355 | "the earliest unique commit helps with discoverability. It defaults to the root commit. Only change this if your repo has completely forked off an has formed its own identity." | ||
| 356 | ); | ||
| 358 | loop { | 357 | loop { |
| 359 | earliest_unique_commit = Interactor::default().input( | 358 | earliest_unique_commit = Interactor::default().input( |
| 360 | PromptInputParms::default() | 359 | PromptInputParms::default() |