Create dialoguer themes based on global config

finchie
Aug 16, 2022, 8:50 AM
FVQYZQFL7WHSC3UUPJ4IWTP7SKTDQ4K6K5HY4EDK3JKXG3CQNZEAC

Dependencies

  • [2] ZSFJT4SF Allow remotes to have a different push and pull address
  • [3] EEBKW7VT Keys and identities
  • [4] A3RM526Y Integrating identity malleability
  • [5] 5BB266P6 Optional colours in the global config file
  • [6] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [7] SEWGHUHQ .pijul/config: simplify remotes and hooks
  • [8] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [9] IUGP6ZGB Add support for ~/.config/pijul even on macos
  • [*] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [*] TFPETWTV Add config options for patch message templates

Change contents

  • edit in pijul/src/config.rs at line 6
    [3.11466]
    [11.960]
    use dialoguer::theme;
  • replacement in pijul/src/config.rs at line 22
    [3.182][3.12694:12750]()
    pub key_path: Option<String>,
    pub name: String,
    [3.182]
    [3.236]
    // This is for backwards compatability with older versions
    #[serde(alias = "name")]
    pub login: String,
  • edit in pijul/src/config.rs at line 39
    [12.66]
    [12.66]
    impl Default for Choice {
    fn default() -> Self {
    Self::Auto
    }
    }
  • replacement in pijul/src/config.rs at line 55
    [3.407][3.407:460]()
    if let Some(mut dir) = dirs_next::config_dir() {
    [3.407]
    [3.460]
    if let Ok(path) = std::env::var("PIJUL_CONFIG_DIR") {
    let dir = std::path::PathBuf::from(path);
    Some(dir)
    } else if let Some(mut dir) = dirs_next::config_dir() {
  • replacement in pijul/src/config.rs at line 109
    [3.90973][2.268:307]()
    #[derive(Debug, Deserialize, Default)]
    [3.90973]
    [3.91023]
    #[derive(Debug, Serialize, Deserialize, Default)]
  • replacement in pijul/src/config.rs at line 123
    [2.358][2.358:375]()
    #[derive(Debug)]
    [2.358]
    [2.375]
    #[derive(Debug, Serialize)]
  • replacement in pijul/src/config.rs at line 187
    [3.91199][2.2297:2327]()
    #[derive(Debug, Deserialize)]
    [3.91199]
    [2.2327]
    #[derive(Debug, Serialize, Deserialize)]
  • edit in pijul/src/config.rs at line 319
    [3.93366]
    [3.93366]
    }
    }
    /// Choose the right dialoguer theme based on user's config
    pub fn load_theme() -> Result<Box<dyn theme::Theme>, anyhow::Error> {
    if let Ok((config, _)) = Global::load() {
    let color_choice = config.colors.unwrap_or_default();
    match color_choice {
    Choice::Auto | Choice::Always => Ok(Box::new(theme::ColorfulTheme::default())),
    Choice::Never => Ok(Box::new(theme::SimpleTheme)),
    }
    } else {
    Ok(Box::new(theme::ColorfulTheme::default()))