Show clipboard info in --health output (#2947)

* Show clipboard info in --health output

* health: Separate 'languages' category from 'all'

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
pull/3243/head
Gokul Soumya 2 years ago committed by GitHub
parent 5c3f43a7f0
commit e3e71fa36b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -83,6 +83,33 @@ pub fn general() -> std::io::Result<()> {
Ok(()) Ok(())
} }
pub fn clipboard() -> std::io::Result<()> {
let stdout = std::io::stdout();
let mut stdout = stdout.lock();
let board = get_clipboard_provider();
match board.name().as_ref() {
"none" => {
writeln!(
stdout,
"{}",
"System clipboard provider: Not installed".red()
)?;
writeln!(
stdout,
" {}",
"For troubleshooting system clipboard issues, refer".red()
)?;
writeln!(stdout, " {}",
"https://github.com/helix-editor/helix/wiki/Troubleshooting#copypaste-fromto-system-clipboard-not-working"
.red().underlined())?;
}
name => writeln!(stdout, "System clipboard provider: {}", name)?,
}
Ok(())
}
pub fn languages_all() -> std::io::Result<()> { pub fn languages_all() -> std::io::Result<()> {
let stdout = std::io::stdout(); let stdout = std::io::stdout();
let mut stdout = stdout.lock(); let mut stdout = stdout.lock();
@ -281,13 +308,15 @@ fn probe_treesitter_feature(lang: &str, feature: TsFeature) -> std::io::Result<(
pub fn print_health(health_arg: Option<String>) -> std::io::Result<()> { pub fn print_health(health_arg: Option<String>) -> std::io::Result<()> {
match health_arg.as_deref() { match health_arg.as_deref() {
Some("all") => languages_all()?, Some("languages") => languages_all()?,
Some(lang) => language(lang.to_string())?, Some("clipboard") => clipboard()?,
None => { None | Some("all") => {
general()?; general()?;
clipboard()?;
writeln!(std::io::stdout().lock())?; writeln!(std::io::stdout().lock())?;
languages_all()?; languages_all()?;
} }
Some(lang) => language(lang.to_string())?,
} }
Ok(()) Ok(())
} }

@ -61,8 +61,9 @@ ARGS:
FLAGS: FLAGS:
-h, --help Prints help information -h, --help Prints help information
--tutor Loads the tutorial --tutor Loads the tutorial
--health [LANG] Checks for potential errors in editor setup --health [CATEGORY] Checks for potential errors in editor setup
If given, checks for config errors in language LANG CATEGORY can be a language or one of 'clipboard', 'languages'
or 'all'. 'all' is the default if not specified.
-g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml -g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml
-c, --config <file> Specifies a file to use for configuration -c, --config <file> Specifies a file to use for configuration
-v Increases logging verbosity each use for up to 3 times -v Increases logging verbosity each use for up to 3 times

Loading…
Cancel
Save