added command-line argument to specify repository path

CrepeGoat
Oct 10, 2024, 6:43 AM
6M4YFQEBKKTUYSEOAJQPAGLD2LVV3PY62SPMP7PUKJ64S7XGH4SQC

Dependencies

  • [2] PL4TK55O added command-line argument to specify executable path
  • [3] 4RPYR65C connect GUI to pijul to display simple channel list
  • [4] IQY5LHEN add GUI element to display simple `pijul log` results
  • [5] NCRTU7M4 cargo init
  • [6] NSE6BLWA init slint project from https://github.com/slint-ui/slint-rust-template
  • [*] 6ECOC7L5 parsed `pijul channel` text blob into individual UI components

Change contents

  • edit in ui/app-window.slint at line 106
    [2.35]
    [8.792]
    in property <string> repo_path;
  • replacement in src/main.rs at line 6
    [3.228][3.228:249]()
    use std::path::Path;
    [3.228]
    [3.709]
    use std::path::{Path, PathBuf};
  • edit in src/main.rs at line 19
    [2.131]
    [3.836]
    ui.set_repo_path(match cli_args.repo_path {
    Some(path_str) => path_str.into(),
    None => path_to_uistr(std::env::current_dir()?),
    });
  • replacement in src/main.rs at line 31
    [2.250][2.250:330]()
    let repo_path = Path::new("/Users/beckerawqatty/Repos/pijul-gui/");
    [2.250]
    [2.330]
    let repo_path_string = ui.get_repo_path();
    let repo_path = Path::new(repo_path_string.as_str());
  • replacement in src/main.rs at line 60
    [2.513][2.513:593]()
    let repo_path = Path::new("/Users/beckerawqatty/Repos/pijul-gui/");
    [2.513]
    [2.593]
    let repo_path_string = ui.get_repo_path();
    let repo_path = Path::new(repo_path_string.as_str());
  • replacement in src/main.rs at line 98
    [2.738][2.738:841]()
    /// the file path of the `pijul` executable
    #[argh(option, default = "\"pijul\".to_string()")]
    [2.738]
    [2.841]
    /// the file system path of the `pijul` executable
    #[argh(option, default = "\"pijul\".into()")]
    // TODO argh does not support OS strings:
    // https://github.com/google/argh/blob/f02f6b44444b340a553ff2db298744721ebc77a7/argh/src/lib.rs#L698
    // -> use raw std::env::args_os?:
    // https://doc.rust-lang.org/std/env/fn.args_os.html
    //exe_path: PathBuf,
  • edit in src/main.rs at line 106
    [2.863]
    [2.863]
    /// the file system path of the pijul repository (i.e., the directory containing the `.pijul` folder)
    #[argh(option)]
    // TODO argh does not support OS strings:
    // https://github.com/google/argh/blob/f02f6b44444b340a553ff2db298744721ebc77a7/argh/src/lib.rs#L698
    // -> use raw std::env::args_os?:
    // https://doc.rust-lang.org/std/env/fn.args_os.html
    // repo_path: Option<PathBuf>,
    repo_path: Option<String>,
    }
    fn path_to_uistr(path: PathBuf) -> SharedString {
    format!("{:?}", path).into()