feat(config): Adds support for --profile <custom profile name> (#3467)

Co-authored-by: Kevin Song <chips@ksong.dev>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
This commit is contained in:
Florent Vilmart
2023-01-11 22:25:36 -05:00
committed by GitHub
parent bb549e665e
commit 10433e31ef
5 changed files with 115 additions and 20 deletions
+10 -5
View File
@@ -85,8 +85,11 @@ enum Commands {
/// Print the right prompt (instead of the standard left prompt)
#[clap(long)]
right: bool,
/// Print the continuation prompt (instead of the standard left prompt)
/// Print the prompt with the specified profile name (instead of the standard left prompt)
#[clap(long, conflicts_with = "right")]
profile: Option<String>,
/// Print the continuation prompt (instead of the standard left prompt)
#[clap(long, conflicts_with = "right", conflicts_with = "profile")]
continuation: bool,
#[clap(flatten)]
properties: Properties,
@@ -172,12 +175,14 @@ fn main() {
Commands::Prompt {
properties,
right,
profile,
continuation,
} => {
let target = match (right, continuation) {
(true, _) => Target::Right,
(_, true) => Target::Continuation,
(_, _) => Target::Main,
let target = match (right, profile, continuation) {
(true, _, _) => Target::Right,
(_, Some(profile_name), _) => Target::Profile(profile_name),
(_, _, true) => Target::Continuation,
(_, _, _) => Target::Main,
};
print::prompt(properties, target)
}