Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 2 additions & 66 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,72 +661,8 @@ fn is_likely_command(text: &str) -> bool {
}

let first_word = text.split_whitespace().next().unwrap_or("");
let command_starters = [
"ls",
"cd",
"rm",
"cp",
"mv",
"mkdir",
"touch",
"cat",
"echo",
"grep",
"find",
"chmod",
"chown",
"sudo",
"apt",
"yum",
"brew",
"npm",
"yarn",
"cargo",
"git",
"docker",
"kubectl",
"systemctl",
"service",
"curl",
"wget",
"tar",
"zip",
"unzip",
"ssh",
"scp",
"rsync",
"ps",
"kill",
"top",
"htop",
"df",
"du",
"free",
"ping",
"traceroute",
"netstat",
"ss",
"iptables",
"ufw",
"python",
"python3",
"node",
"ruby",
"perl",
"php",
"java",
"go",
"rustc",
"gcc",
"g++",
"make",
"cmake",
"./",
"/",
"~",
];

command_starters

crate::providers::COMMAND_STARTERS
.iter()
.any(|cmd| first_word.starts_with(cmd))
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::config::Config;
use anyhow::{anyhow, Result};

/// List of common command prefixes used to detect if a line is a shell command.
const COMMAND_STARTERS: &[&str] = &[
pub const COMMAND_STARTERS: &[&str] = &[
"ls",
"cd",
"rm",
Expand Down