on master help sign in
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>

commite3e71fa36be14659f0eabe1d4c80ef7e68135a6a authorGokul Soumya <gokulps15@gmail.com> dateWed 31 Aug 2022, 21:53 (4 years ago) parent5c3f43a
2 files changed+35−5
helix-term/src/health.rs+32−3 helix-term/src/main.rs+3−2
helix-term/src/health.rs+32−3
@@ -83,6 +83,33 @@ pub fn general() -> std::io::Result<()> {
8383 Ok(())
8484}
8585
86+pub fn clipboard() -> std::io::Result<()> {
87+ let stdout = std::io::stdout();
88+ let mut stdout = stdout.lock();
89+
90+ let board = get_clipboard_provider();
91+ match board.name().as_ref() {
92+ "none" => {
93+ writeln!(
94+ stdout,
95+ "{}",
96+ "System clipboard provider: Not installed".red()
97+ )?;
98+ writeln!(
99+ stdout,
100+ " {}",
101+ "For troubleshooting system clipboard issues, refer".red()
102+ )?;
103+ writeln!(stdout, " {}",
104+ "https://github.com/helix-editor/helix/wiki/Troubleshooting#copypaste-fromto-system-clipboard-not-working"
105+ .red().underlined())?;
106+ }
107+ name => writeln!(stdout, "System clipboard provider: {}", name)?,
108+ }
109+
110+ Ok(())
111+}
112+
86113pub fn languages_all() -> std::io::Result<()> {
87114 let stdout = std::io::stdout();
88115 let mut stdout = stdout.lock();
@@ -281,13 +308,15 @@ fn probe_treesitter_feature(lang: &str, feature: TsFeature) -> std::io::Result<(
281308
282309pub fn print_health(health_arg: Option<String>) -> std::io::Result<()> {
283310 match health_arg.as_deref() {
284− Some("all") => languages_all()?,
285− Some(lang) => language(lang.to_string())?,
286− None => {
311+ Some("languages") => languages_all()?,
312+ Some("clipboard") => clipboard()?,
313+ None | Some("all") => {
287314 general()?;
315+ clipboard()?;
288316 writeln!(std::io::stdout().lock())?;
289317 languages_all()?;
290318 }
319+ Some(lang) => language(lang.to_string())?,
291320 }
292321 Ok(())
293322}
helix-term/src/main.rs+3−2
@@ -61,8 +61,9 @@ ARGS:
6161FLAGS:
6262 -h, --help Prints help information
6363 --tutor Loads the tutorial
64− --health [LANG] Checks for potential errors in editor setup
65− If given, checks for config errors in language LANG
64+ --health [CATEGORY] Checks for potential errors in editor setup
65+ CATEGORY can be a language or one of 'clipboard', 'languages'
66+ or 'all'. 'all' is the default if not specified.
6667 -g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml
6768 -c, --config <file> Specifies a file to use for configuration
6869 -v Increases logging verbosity each use for up to 3 times