aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorGokul Soumya2022-08-31 16:23:45 +0000
committerGitHub2022-08-31 16:23:45 +0000
commite3e71fa36be14659f0eabe1d4c80ef7e68135a6a (patch)
treec2faf04d3b09c538345f72d1eac2d7ad0bf7888f /helix-term/src
parent5c3f43a7f0c5392242424912bde992d9305c0c8e (diff)
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>
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/health.rs35
-rw-r--r--helix-term/src/main.rs5
2 files changed, 35 insertions, 5 deletions
diff --git a/helix-term/src/health.rs b/helix-term/src/health.rs
index 4a266e48..ac9f06fc 100644
--- a/helix-term/src/health.rs
+++ b/helix-term/src/health.rs
@@ -83,6 +83,33 @@ pub fn general() -> std::io::Result<()> {
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<()> {
let stdout = std::io::stdout();
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<()> {
match health_arg.as_deref() {
- Some("all") => languages_all()?,
- Some(lang) => language(lang.to_string())?,
- None => {
+ Some("languages") => languages_all()?,
+ Some("clipboard") => clipboard()?,
+ None | Some("all") => {
general()?;
+ clipboard()?;
writeln!(std::io::stdout().lock())?;
languages_all()?;
}
+ Some(lang) => language(lang.to_string())?,
}
Ok(())
}
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index 7f04f201..d21d3e77 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -61,8 +61,9 @@ ARGS:
FLAGS:
-h, --help Prints help information
--tutor Loads the tutorial
- --health [LANG] Checks for potential errors in editor setup
- If given, checks for config errors in language LANG
+ --health [CATEGORY] Checks for potential errors in editor setup
+ 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
-c, --config <file> Specifies a file to use for configuration
-v Increases logging verbosity each use for up to 3 times