on master help sign in
Show clipboard info in --health output (#2947)
e3e71faGokul Soumya
helix-term/src/health.rs+32−3
@@ -83,6 +83,33 @@ pub fn general() -> std::io::Result<()> {
83 Ok(())
83 Ok(())
84}
84}
85
85
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+
86pub fn languages_all() -> std::io::Result<()> {
113pub fn languages_all() -> std::io::Result<()> {
87 let stdout = std::io::stdout();
114 let stdout = std::io::stdout();
88 let mut stdout = stdout.lock();
115 let mut stdout = stdout.lock();
@@ -281,13 +308,15 @@ fn probe_treesitter_feature(lang: &str, feature: TsFeature) -> std::io::Result<(
281
308
282pub fn print_health(health_arg: Option<String>) -> std::io::Result<()> {
309pub fn print_health(health_arg: Option<String>) -> std::io::Result<()> {
283 match health_arg.as_deref() {
310 match health_arg.as_deref() {
284− Some("all") => languages_all()?,
311+ Some("languages") => languages_all()?,
285− Some(lang) => language(lang.to_string())?,
312+ Some("clipboard") => clipboard()?,
286− None => {
313+ None | Some("all") => {
287 general()?;
314 general()?;
315+ clipboard()?;
288 writeln!(std::io::stdout().lock())?;
316 writeln!(std::io::stdout().lock())?;
289 languages_all()?;
317 languages_all()?;
290 }
318 }
319+ Some(lang) => language(lang.to_string())?,
291 }
320 }
292 Ok(())
321 Ok(())
293}
322}
helix-term/src/main.rs+3−2
@@ -61,8 +61,9 @@ ARGS:
61FLAGS:
61FLAGS:
62 -h, --help Prints help information
62 -h, --help Prints help information
63 --tutor Loads the tutorial
63 --tutor Loads the tutorial
64− --health [LANG] Checks for potential errors in editor setup
64+ --health [CATEGORY] Checks for potential errors in editor setup
65− If given, checks for config errors in language LANG
65+ CATEGORY can be a language or one of 'clipboard', 'languages'
66+ or 'all'. 'all' is the default if not specified.
66 -g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml
67 -g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml
67 -c, --config <file> Specifies a file to use for configuration
68 -c, --config <file> Specifies a file to use for configuration
68 -v Increases logging verbosity each use for up to 3 times
69 -v Increases logging verbosity each use for up to 3 times