helper: Add `-o hints` push option

Works even if you have hints disabled in config.
This commit is contained in:
Alexis Sellier 2024-03-18 12:57:32 +01:00
parent 9cd1b0ec46
commit 623ef278d0
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View File

@ -77,6 +77,8 @@ pub struct Allow {
pub struct Options { pub struct Options {
/// Don't sync after push. /// Don't sync after push.
no_sync: bool, no_sync: bool,
/// Enable hints.
hints: bool,
/// Open patch in draft mode. /// Open patch in draft mode.
draft: bool, draft: bool,
/// Patch base to use, when opening or updating a patch. /// Patch base to use, when opening or updating a patch.
@ -206,6 +208,7 @@ pub fn run(profile: radicle::Profile) -> Result<(), Error> {
/// hence the arguments are passed as a slice. /// hence the arguments are passed as a slice.
fn push_option(args: &[&str], opts: &mut Options) -> Result<(), Error> { fn push_option(args: &[&str], opts: &mut Options) -> Result<(), Error> {
match args { match args {
["hints"] => opts.hints = true,
["sync"] => opts.no_sync = false, ["sync"] => opts.no_sync = false,
["no-sync"] => opts.no_sync = true, ["no-sync"] => opts.no_sync = true,
["patch.draft"] => opts.draft = true, ["patch.draft"] => opts.draft = true,

View File

@ -173,7 +173,7 @@ pub fn run(
let signer = profile.signer()?; let signer = profile.signer()?;
let mut line = String::new(); let mut line = String::new();
let mut ok = HashMap::new(); let mut ok = HashMap::new();
let hints = profile.hints(); let hints = opts.hints || profile.hints();
assert_eq!(signer.public_key(), &nid); assert_eq!(signer.public_key(), &nid);