Add global `no_prompt` flag

finchie
Aug 17, 2023, 5:51 AM
WTPFQPO5C3OWNOEIZQSIMAR7O6URYJJNUJSWDZUTWFDDAMNFMTLQC

Dependencies

  • [2] 5WERCJKL Check if any identities exist before removal
  • [3] 5Z2Y7VGV Migrate `pijul::identity::Complete::prove` to `pijul::remote::prove`
  • [4] SNZ3OAMC use native external subcommand support instead of hand-rolled one
  • [5] A3RM526Y Integrating identity malleability
  • [6] 44RUBHRE Only re-prove identity when credentials change
  • [7] SFY4U6XE remove redundant conditional compilation
  • [8] 4RV7T4SR Migrate from `pijul::config` to `pijul-config`
  • [9] LZOGKBJX new command `pijul client` for authenticating to a HTTP server
  • [10] 4KJ45IJL Implement new identity management
  • [11] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [12] RJMQSZER External commands
  • [13] YJXRCXOS Disallow overwriting existing identities via `pijul id edit`
  • [14] EEBKW7VT Keys and identities
  • [15] DOEG3V7U Only re-write identity data when changed
  • [16] 32G3GOK7 Migrate from `dialoguer` to `pijul-interaction`
  • [17] YVA72CP2 Default feedback for the `pijul git` command
  • [18] DWSAYGVE Update codebase to use new identity management
  • [19] KKNMDXAI Tweak identity subcommand
  • [20] 4OJWMSOW Fully replace crate::Identity
  • [21] RP7YRM5Q Import Git repos without writing anything to disk
  • [*] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [*] QL6K2ZM3 Tags

Change contents

  • edit in pijul/src/main.rs at line 11
    [23.694]
    [23.716]
    use pijul_interaction::InteractiveContext;
  • edit in pijul/src/main.rs at line 22
    [4.84538]
    [4.84538]
    /// Abort rather than prompt for input
    #[clap(long, global = true)]
    pub no_prompt: bool,
  • edit in pijul/src/main.rs at line 155
    [4.20][4.672:757]()
    pijul_interaction::set_context(pijul_interaction::InteractiveContext::Terminal);
  • edit in pijul/src/main.rs at line 160
    [4.106]
    [4.100]
  • edit in pijul/src/main.rs at line 162
    [4.130]
    [4.422]
    if opts.no_prompt {
    pijul_interaction::set_context(InteractiveContext::NotInteractive);
    } else {
    pijul_interaction::set_context(InteractiveContext::Terminal);
    }
  • replacement in pijul/src/identity/repair.rs at line 42
    [4.3347][4.3347:3509]()
    ///
    /// # Arguments
    /// * `no_prompt` - If the user should not be prompted for input.
    pub async fn fix_identities(no_prompt: bool) -> Result<(), anyhow::Error> {
    [4.3347]
    [4.3509]
    pub async fn fix_identities() -> Result<(), anyhow::Error> {
  • replacement in pijul/src/identity/repair.rs at line 63
    [4.4220][4.0:69]()
    old_identity.clone().create(no_prompt, true).await?;
    [4.4220]
    [4.4888]
    old_identity.clone().create(true).await?;
  • edit in pijul/src/identity/repair.rs at line 88
    [4.6056][4.6056:6185]()
    if no_prompt {
    bail!("No identities configured");
    }
  • replacement in pijul/src/identity/repair.rs at line 89
    [4.6256][4.6256:6333]()
    Complete::default()?.create(no_prompt, true).await?;
    [4.6256]
    [4.6333]
    Complete::default()?.create(true).await?;
  • edit in pijul/src/identity/load.rs at line 66
    [4.24405][4.24405:24491]()
    /// # Arguments
    /// * `no_prompt` - If the user should not be prompted for input.
    ///
  • replacement in pijul/src/identity/load.rs at line 68
    [4.24577][4.24577:24663]()
    pub async fn choose_identity_name(no_prompt: bool) -> Result<String, anyhow::Error> {
    [4.24577]
    [4.24663]
    pub async fn choose_identity_name() -> Result<String, anyhow::Error> {
  • replacement in pijul/src/identity/load.rs at line 75
    [4.24848][4.24848:24890]()
    fix_identities(no_prompt).await?;
    [4.24848]
    [4.24890]
    fix_identities().await?;
  • edit in pijul/src/identity/load.rs at line 81
    [4.25052][4.25052:25155]()
    } else if no_prompt {
    bail!("Cannot prompt user to choose identity (--no-prompt is set)");
  • edit in pijul/src/identity/create.rs at line 268
    [4.38371][4.38371:38441]()
    /// * `no_prompt` - If the user should not be prompted for input.
  • replacement in pijul/src/identity/create.rs at line 269
    [4.38529][4.1720:1818]()
    pub async fn create(&self, no_prompt: bool, link_remote: bool) -> Result<(), anyhow::Error> {
    [4.38529]
    [4.14019]
    pub async fn create(&self, link_remote: bool) -> Result<(), anyhow::Error> {
  • replacement in pijul/src/identity/create.rs at line 271
    [4.14076][4.38665:38713](),[4.38665][4.38665:38713](),[4.38713][4.14077:14102](),[4.14102][4.38730:38747](),[4.38730][4.38730:38747](),[4.38747][4.966:1024](),[4.1024][4.38787:38799](),[4.14162][4.38787:38799](),[4.38787][4.38787:38799]()
    let confirmed_identity = if no_prompt {
    self.clone()
    } else {
    self.prompt_changes(None, link_remote).await?
    };
    [4.14076]
    [4.1007]
    let confirmed_identity = self.prompt_changes(None, link_remote).await?;
  • replacement in pijul/src/commands/tag.rs at line 281
    [4.788][4.229:329](),[4.229][4.229:329]()
    let k = crate::identity::public_key(&crate::identity::choose_identity_name(false).await?)?;
    [4.788]
    [4.329]
    let k = crate::identity::public_key(&crate::identity::choose_identity_name().await?)?;
  • replacement in pijul/src/commands/record.rs at line 153
    [4.15216][4.15216:15315]()
    crate::identity::Complete::load(&crate::identity::choose_identity_name(false).await?)?
    [4.15216]
    [4.15315]
    crate::identity::Complete::load(&crate::identity::choose_identity_name().await?)?
  • replacement in pijul/src/commands/record.rs at line 227
    [4.953][4.953:1038]()
    .unwrap_or(crate::identity::choose_identity_name(false).await?),
    [4.953]
    [4.1038]
    .unwrap_or(crate::identity::choose_identity_name().await?),
  • replacement in pijul/src/commands/identity.rs at line 156
    [4.46167][4.46167:46295]()
    Repair {
    /// Abort rather than prompt for input
    #[clap(long = "no-prompt")]
    no_prompt: bool,
    },
    [4.46167]
    [4.46295]
    Repair,
  • edit in pijul/src/commands/identity.rs at line 164
    [4.4441][4.46469:46577](),[4.46469][4.46469:46577]()
    /// Abort rather than prompt for input
    #[clap(long = "no-prompt")]
    no_prompt: bool,
  • replacement in pijul/src/commands/identity.rs at line 252
    [4.49307][4.49307:49384]()
    identity.create(options.no_prompt, !options.no_link).await?;
    [4.49307]
    [3.1971]
    identity.create(!options.no_link).await?;
  • replacement in pijul/src/commands/identity.rs at line 260
    [4.49398][4.49398:49480]()
    SubCommand::Repair { no_prompt } => fix_identities(no_prompt).await?,
    [4.49398]
    [4.49480]
    SubCommand::Repair => fix_identities().await?,
  • edit in pijul/src/commands/identity.rs at line 264
    [4.4466][4.49543:49570](),[4.49543][4.49543:49570]()
    no_prompt,
  • replacement in pijul/src/commands/identity.rs at line 265
    [4.49589][3.2534:2656]()
    let identity_name =
    &identity_name.unwrap_or(choose_identity_name(no_prompt).await?);
    [4.49589]
    [3.2656]
    let identity_name = &identity_name.unwrap_or(choose_identity_name().await?);
  • replacement in pijul/src/commands/identity.rs at line 376
    [4.54509][4.54509:54576]()
    choose_identity_name(options.no_prompt).await?
    [4.54509]
    [4.54576]
    choose_identity_name().await?
  • replacement in pijul/src/commands/identity.rs at line 430
    [2.176][4.55866:56019](),[4.55866][4.55866:56019]()
    let identity = Complete::load(
    &identity_name.unwrap_or(choose_identity_name(no_prompt).await?),
    )?;
    [2.176]
    [4.56019]
    let identity =
    Complete::load(&identity_name.unwrap_or(choose_identity_name().await?))?;