Repository: casey/just
File: src/config.rs (Rust)

Code before:
use {
  super::*,
  clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, ArgSettings},
};

// These two strings, and the two in function chooser_default below should be kept in sync:
pub(crate) const CHOOSER_ENVIRONMENT_KEY: &str = "JUST_CHOOSER";
pub(crate) const CHOOSE_HELP: &str = "Select one or more recipes to run using a binary. If \
                                      `--chooser` is not passed the chooser defaults to the value \
                                      of $JUST_CHOOSER, falling back to `fzf`";

// Return the string for the default chooser. This is a function and not a const, because we want
// to edit the preview command and pass it the right justfile path for the target.
pub(crate) fn chooser_default(justfile: &Justfile) -> OsString {
  match justfile.default {
    Some(ref default) => {
      let mut chooser = OsString::new();
      chooser.push("fzf --multi --preview 'just --unstable --color always --justfile ");
      chooser.push(default.name.path);
      chooser.push(" --show {}'");
      chooser
    }
    None => OsString::from("fzf --multi --preview 'just --unstable --color always --show {}'"),
  }
}

#[derive(Debug, PartialEq)]
#[allow(clippy::struct_excessive_bools)]
pub(crate) struct Config {
  pub(crate) check: bool,
  pub(crate) color: Color,
  pub(crate) command_color: Option<ansi_term::Color>,
  pub(crate) dotenv_filename: Option<String>,
  pub(crate) dotenv_path: Option<PathBuf>,
  pub(crate) dry_run: bool,
  pub(crate) dump_format: DumpFormat,
  pub(crate) highlight: bool,
  pub(crate) invocation_directory: PathBuf,
  pub(crate) list_heading: String,

Review comment (suggestion):
```suggestion
pub(crate) fn chooser_default(justfile: &Path) -> OsString {
```

Code after:
use {
  super::*,
  clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, ArgSettings},
};

pub(crate) const CHOOSER_ENVIRONMENT_KEY: &str = "JUST_CHOOSER";

pub(crate) const CHOOSE_HELP: &str = "Select one or more recipes to run using a binary chooser. \
                                      If `--chooser` is not passed the chooser defaults to the \
                                      value of $JUST_CHOOSER, falling back to `fzf`";

pub(crate) fn chooser_default(justfile: &Path) -> OsString {
  let mut chooser = OsString::new();
  chooser.push("fzf --multi --preview 'just --unstable --color always --justfile \"");
  chooser.push(justfile);
  chooser.push("\" --show {}'");
  chooser
}

#[derive(Debug, PartialEq)]
#[allow(clippy::struct_excessive_bools)]
pub(crate) struct Config {
  pub(crate) check: bool,
  pub(crate) color: Color,
  pub(crate) command_color: Option<ansi_term::Color>,
  pub(crate) dotenv_filename: Option<String>,
  pub(crate) dotenv_path: Option<PathBuf>,
  pub(crate) dry_run: bool,
  pub(crate) dump_format: DumpFormat,
  pub(crate) highlight: bool,
  pub(crate) invocation_directory: PathBuf,
  pub(crate) list_heading: String,
  pub(crate) list_prefix: String,
  pub(crate) load_dotenv: bool,
  pub(crate) search_config: SearchConfig,
  pub(crate) shell: Option<String>,
  pub(crate) shell_args: Option<Vec<String>>,
  pub(crate) shell_command: bool,
  pub(crate) subcommand: Subcommand,