From e5fa6978fa9b39e0b3454a9ee6a623d9674b5efd Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 18:27:01 +0000 Subject: [PATCH 01/20] Port structured Fig postProcess and token-aware Teams users Replace line-split parsing with shared helpers for JSON, tables, and other structured Fig postProcess. Add a token-aware Fig Teams user generator. --- command-signatures/json/fig-teams.json | 4 +- command-signatures/src/generators/amplify.rs | 2 +- command-signatures/src/generators/apt.rs | 4 +- command-signatures/src/generators/assimp.rs | 2 +- command-signatures/src/generators/cargo.rs | 2 +- command-signatures/src/generators/copilot.rs | 2 +- command-signatures/src/generators/cordova.rs | 2 +- command-signatures/src/generators/deno.rs | 4 +- .../src/generators/deployctl.rs | 2 +- command-signatures/src/generators/deta.rs | 2 +- command-signatures/src/generators/eb.rs | 5 +- command-signatures/src/generators/expo.rs | 6 +- command-signatures/src/generators/expo_cli.rs | 6 +- command-signatures/src/generators/ffmpeg.rs | 4 +- .../src/generators/fig_parse.rs | 292 +++++++++++++++++- .../src/generators/fig_teams_latest.rs | 40 ++- command-signatures/src/generators/fly.rs | 4 +- command-signatures/src/generators/flyctl.rs | 4 +- command-signatures/src/generators/fnm.rs | 7 +- command-signatures/src/generators/gh.rs | 2 +- command-signatures/src/generators/git.rs | 2 +- command-signatures/src/generators/lerna.rs | 2 +- command-signatures/src/generators/limactl.rs | 2 +- command-signatures/src/generators/mosh.rs | 2 +- command-signatures/src/generators/npm.rs | 2 +- command-signatures/src/generators/nr.rs | 2 +- command-signatures/src/generators/ns.rs | 2 +- command-signatures/src/generators/okteto.rs | 2 +- .../src/generators/pre_commit.rs | 2 +- command-signatures/src/generators/rush.rs | 2 +- command-signatures/src/generators/rushx.rs | 2 +- command-signatures/src/generators/sftp.rs | 2 +- command-signatures/src/generators/trex.rs | 2 +- command-signatures/src/generators/vr.rs | 2 +- command-signatures/src/generators/watson.rs | 2 +- command-signatures/src/generators/wd.rs | 2 +- 36 files changed, 375 insertions(+), 53 deletions(-) diff --git a/command-signatures/json/fig-teams.json b/command-signatures/json/fig-teams.json index 2ccecfce..ff5b0a6e 100644 --- a/command-signatures/json/fig-teams.json +++ b/command-signatures/json/fig-teams.json @@ -61,7 +61,7 @@ ], "args": { "name": "email", - "template": "filepaths" + "generatorName": "npx_fig_teams_latest_users" } }, { @@ -82,7 +82,7 @@ ], "args": { "name": "email", - "template": "filepaths" + "generatorName": "npx_fig_teams_latest_users" } } ] diff --git a/command-signatures/src/generators/amplify.rs b/command-signatures/src/generators/amplify.rs index 8920f6ed..3141dccf 100644 --- a/command-signatures/src/generators/amplify.rs +++ b/command-signatures/src/generators/amplify.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "env_list", Generator::script( CommandBuilder::single_command("amplify env list --json"), - fig_parse::lines, + fig_parse::json_envs, ), ) } diff --git a/command-signatures/src/generators/apt.rs b/command-signatures/src/generators/apt.rs index 8680f984..0b4bed43 100644 --- a/command-signatures/src/generators/apt.rs +++ b/command-signatures/src/generators/apt.rs @@ -106,14 +106,14 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("apt list --installed"), - fig_parse::lines, + fig_parse::apt_package_before_slash, ), ) .add_generator( "list_upgradable", Generator::script( CommandBuilder::single_command("apt list --upgradable"), - fig_parse::lines, + fig_parse::apt_package_before_slash, ), ) } diff --git a/command-signatures/src/generators/assimp.rs b/command-signatures/src/generators/assimp.rs index 486e69d2..94c7841a 100644 --- a/command-signatures/src/generators/assimp.rs +++ b/command-signatures/src/generators/assimp.rs @@ -14,7 +14,7 @@ pub fn generator() -> CommandSignatureGenerators { "listext", Generator::script( CommandBuilder::single_command("assimp listext"), - fig_parse::lines, + fig_parse::lines_desc_extension, ), ) } diff --git a/command-signatures/src/generators/cargo.rs b/command-signatures/src/generators/cargo.rs index f3286364..7606ad22 100644 --- a/command-signatures/src/generators/cargo.rs +++ b/command-signatures/src/generators/cargo.rs @@ -157,7 +157,7 @@ pub fn generator() -> CommandSignatureGenerators { "read_manifest", Generator::script( CommandBuilder::single_command("cargo read-manifest"), - fig_parse::lines, + fig_parse::json_string_array, ), ) } diff --git a/command-signatures/src/generators/copilot.rs b/command-signatures/src/generators/copilot.rs index 24875e83..7863d930 100644 --- a/command-signatures/src/generators/copilot.rs +++ b/command-signatures/src/generators/copilot.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_copilot_workspace", Generator::script( CommandBuilder::single_command("cat copilot/.workspace"), - fig_parse::lines, + fig_parse::yaml_application, ), ) } diff --git a/command-signatures/src/generators/cordova.rs b/command-signatures/src/generators/cordova.rs index 6c03ae20..8b050c09 100644 --- a/command-signatures/src/generators/cordova.rs +++ b/command-signatures/src/generators/cordova.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_package_json", Generator::script( CommandBuilder::single_command("cat package.json"), - fig_parse::lines, + fig_parse::json_cordova_platforms, ), ) .add_generator( diff --git a/command-signatures/src/generators/deno.rs b/command-signatures/src/generators/deno.rs index 7456dac2..95f58ed4 100644 --- a/command-signatures/src/generators/deno.rs +++ b/command-signatures/src/generators/deno.rs @@ -9,7 +9,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "curl -sL 'https://cdn.deno.land/deno/meta/versions.json'", ), - fig_parse::lines, + fig_parse::json_string_array, ), ) .add_generator( @@ -23,7 +23,7 @@ pub fn generator() -> CommandSignatureGenerators { "lint", Generator::script( CommandBuilder::single_command("deno lint --rules --json"), - fig_parse::lines, + fig_parse::json_deno_codes, ), ) } diff --git a/command-signatures/src/generators/deployctl.rs b/command-signatures/src/generators/deployctl.rs index e2772b4d..70a04017 100644 --- a/command-signatures/src/generators/deployctl.rs +++ b/command-signatures/src/generators/deployctl.rs @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "curl -sL 'https://cdn.deno.land/deploy/meta/versions.json'", ), - fig_parse::lines, + fig_parse::json_string_array, ), ) } diff --git a/command-signatures/src/generators/deta.rs b/command-signatures/src/generators/deta.rs index 69c0a68a..f39b689f 100644 --- a/command-signatures/src/generators/deta.rs +++ b/command-signatures/src/generators/deta.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "node12_node14_python3_7_python3", Generator::script( CommandBuilder::single_command("echo node12, node14, python3.7, python3.9"), - fig_parse::lines, + fig_parse::lines_desc_runtime, ), ) } diff --git a/command-signatures/src/generators/eb.rs b/command-signatures/src/generators/eb.rs index c5ea95c0..29cab9ac 100644 --- a/command-signatures/src/generators/eb.rs +++ b/command-signatures/src/generators/eb.rs @@ -4,6 +4,9 @@ use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Gener pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("eb").add_generator( "list", - Generator::script(CommandBuilder::single_command("eb list"), fig_parse::lines), + Generator::script( + CommandBuilder::single_command("eb list"), + fig_parse::strip_star_prefix, + ), ) } diff --git a/command-signatures/src/generators/expo.rs b/command-signatures/src/generators/expo.rs index ed6d04ce..2f9b105b 100644 --- a/command-signatures/src/generators/expo.rs +++ b/command-signatures/src/generators/expo.rs @@ -7,21 +7,21 @@ pub fn generator() -> CommandSignatureGenerators { "sysctl_hw_ncpu", Generator::script( CommandBuilder::single_command("sysctl -n hw.ncpu"), - fig_parse::lines, + fig_parse::descending_count, ), ) .add_generator( "xcodebuild_ios_xcodeproj", Generator::script( CommandBuilder::single_command("xcodebuild -project ios/*.xcodeproj -list -json"), - fig_parse::lines, + fig_parse::json_string_array, ), ) .add_generator( "xcrun_xctrace_list_devices", Generator::script( CommandBuilder::single_command("xcrun xctrace list devices"), - fig_parse::lines, + fig_parse::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/expo_cli.rs b/command-signatures/src/generators/expo_cli.rs index 8bc629ce..2e371806 100644 --- a/command-signatures/src/generators/expo_cli.rs +++ b/command-signatures/src/generators/expo_cli.rs @@ -7,21 +7,21 @@ pub fn generator() -> CommandSignatureGenerators { "sysctl_hw_ncpu", Generator::script( CommandBuilder::single_command("sysctl -n hw.ncpu"), - fig_parse::lines, + fig_parse::descending_count, ), ) .add_generator( "xcodebuild_ios_xcodeproj", Generator::script( CommandBuilder::single_command("xcodebuild -project ios/*.xcodeproj -list -json"), - fig_parse::lines, + fig_parse::json_string_array, ), ) .add_generator( "xcrun_xctrace_list_devices", Generator::script( CommandBuilder::single_command("xcrun xctrace list devices"), - fig_parse::lines, + fig_parse::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/ffmpeg.rs b/command-signatures/src/generators/ffmpeg.rs index 9c7b30f4..052ebc0c 100644 --- a/command-signatures/src/generators/ffmpeg.rs +++ b/command-signatures/src/generators/ffmpeg.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("ffmpeg -codecs"), - fig_parse::lines, + fig_parse::second_whitespace_token, ), ) .add_generator( "completions_devices", Generator::script( CommandBuilder::single_command("ffmpeg -devices"), - fig_parse::lines, + fig_parse::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/fig_parse.rs b/command-signatures/src/generators/fig_parse.rs index 5685baa5..f18d9505 100644 --- a/command-signatures/src/generators/fig_parse.rs +++ b/command-signatures/src/generators/fig_parse.rs @@ -1,11 +1,301 @@ +use serde_json::Value; use warp_completion_metadata::{GeneratorResults, GeneratorResultsCollector, Suggestion}; /// One suggestion per non-empty trimmed line. pub fn lines(output: &str) -> GeneratorResults { + nonempty_lines(output) + .map(Suggestion::new) + .collect_unordered_results() +} + +pub fn lines_desc_extension(output: &str) -> GeneratorResults { + split_on(output, ';', "Extension") +} + +pub fn lines_desc_runtime(output: &str) -> GeneratorResults { + split_on(output, ',', "Runtime") +} + +pub fn lines_desc_instance(output: &str) -> GeneratorResults { + lines_with_desc(output, "Instance name") +} + +pub fn lines_desc_context(output: &str) -> GeneratorResults { + skip_header_first_token(output, 1, "Context") +} + +pub fn lines_desc_warp_point(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter_map(|line| line.split_whitespace().next()) + .map(|name| Suggestion::with_description(name, "Warp point")) + .collect_unordered_results() +} + +pub fn json_envs(output: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("envs").cloned()) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + value + .as_str() + .map(|name| Suggestion::with_description(name, "Environment")) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn json_string_array(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| value.as_str().map(Suggestion::new)) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn json_cordova_platforms(output: &str) -> GeneratorResults { + match json(output) + .and_then(|v| v.get("cordova").cloned()) + .and_then(|cordova| cordova.get("platforms").cloned()) + { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + value + .as_str() + .map(|name| Suggestion::with_description(name, "Platform")) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn json_rush_projects(output: &str) -> GeneratorResults { + if output.trim().is_empty() { + return empty(); + } + match json(output).and_then(|v| v.get("projects").cloned()) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + value + .get("packageName") + .and_then(Value::as_str) + .map(|name| Suggestion::with_description(name, "Projects")) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn json_deno_codes(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let name = value.get("code")?.as_str()?; + let docs = value.get("docs").and_then(Value::as_str).unwrap_or(""); + let description = docs.split("\n\n").next().unwrap_or(docs); + Some(Suggestion::with_description(name, description)) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn json_nativescript_templates(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let name = value.get("name")?.as_str()?; + Some(Suggestion::with_description( + format!("@nativescript/{name}"), + format!("Template {name}"), + )) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn pipe_table_name_col1_desc(output: &str) -> GeneratorResults { + pipe_table(output, 2, 0, Some(1)) +} + +pub fn git_oneline(output: &str) -> GeneratorResults { + let output = output.trim_start(); + if output.starts_with("fatal:") { + return empty(); + } + nonempty_lines(output) + .map(|line| { + let (hash, rest) = line.split_at(line.len().min(7)); + Suggestion::with_description(hash, rest) + }) + .collect_unordered_results() +} + +pub fn apt_package_before_slash(output: &str) -> GeneratorResults { + nonempty_lines(output) + .map(|line| { + let name = line.split_once('/').map(|(name, _)| name).unwrap_or(line); + Suggestion::with_description(name, "Package") + }) + .collect_unordered_results() +} + +pub fn strip_star_prefix(output: &str) -> GeneratorResults { + nonempty_lines(output) + .map(|line| { + let name = line + .strip_prefix('*') + .map(str::trim) + .unwrap_or_else(|| line.trim()); + Suggestion::new(name) + }) + .collect_unordered_results() +} + +pub fn second_whitespace_token(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter_map(|line| { + line.split_whitespace() + .nth(1) + .filter(|token| *token != "=") + .map(Suggestion::new) + }) + .collect_unordered_results() +} + +pub fn slice2_reversed(output: &str) -> GeneratorResults { + let names: Vec<_> = nonempty_lines(output) + .filter_map(|line| line.get(2..)) + .map(|name| Suggestion::with_description(name, format!("Node.js {name}"))) + .collect(); + GeneratorResults { + suggestions: names.into_iter().rev().collect(), + is_ordered: true, + } +} + +pub fn yaml_application(output: &str) -> GeneratorResults { + if output.trim().is_empty() { + return empty(); + } + for line in output.lines() { + let line = line.trim(); + if let Some(value) = line.strip_prefix("application:") { + let name = value.trim().trim_matches('"').trim_matches('\''); + if !name.is_empty() { + return std::iter::once(Suggestion::new(name)).collect_unordered_results(); + } + } + } + empty() +} + +pub fn descending_count(output: &str) -> GeneratorResults { + let Ok(count) = output.trim().parse::() else { + return empty(); + }; + (1..=count) + .rev() + .map(|n| Suggestion::new(n.to_string())) + .collect_ordered_results() +} + +pub fn json_script_keys(output: &str) -> GeneratorResults { + if output.trim().is_empty() { + return empty(); + } + match json(output).and_then(|v| v.get("scripts").cloned()) { + Some(Value::Object(map)) => map + .into_iter() + .map(|(name, value)| { + let description = value.as_str().unwrap_or("Script"); + Suggestion::with_description(name, description) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn ssh_hosts(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter(|line| line.trim().starts_with("Host ") && !line.contains('*')) + .filter_map(|line| line.split_whitespace().nth(1)) + .map(|name| Suggestion::with_description(name, "SSH host")) + .collect_unordered_results() +} + +fn nonempty_lines(output: &str) -> impl Iterator { output .lines() .map(str::trim) .filter(|line| !line.is_empty()) - .map(Suggestion::new) +} + +fn lines_with_desc(output: &str, description: &'static str) -> GeneratorResults { + nonempty_lines(output) + .map(|line| Suggestion::with_description(line, description)) .collect_unordered_results() } + +fn split_on(output: &str, sep: char, description: &'static str) -> GeneratorResults { + output + .split(sep) + .map(str::trim) + .filter(|part| !part.is_empty()) + .map(|part| Suggestion::with_description(part, description)) + .collect_unordered_results() +} + +fn pipe_table( + output: &str, + skip: usize, + name_col: usize, + desc_col: Option, +) -> GeneratorResults { + nonempty_lines(output) + .skip(skip) + .filter_map(|line| { + let cols: Vec<_> = line.split('|').map(str::trim).collect(); + let name = cols.get(name_col).copied().filter(|s| !s.is_empty())?; + match desc_col.and_then(|i| cols.get(i).copied()) { + Some(description) if !description.is_empty() => { + Some(Suggestion::with_description(name, description)) + } + _ => Some(Suggestion::new(name)), + } + }) + .collect_unordered_results() +} + +fn skip_header_first_token( + output: &str, + skip: usize, + description: &'static str, +) -> GeneratorResults { + nonempty_lines(output) + .skip(skip) + .filter_map(|line| { + let token = line.split_whitespace().next()?.replace('*', ""); + let name = token.trim(); + (!name.is_empty()).then(|| Suggestion::with_description(name, description)) + }) + .collect_unordered_results() +} + +fn json(output: &str) -> Option { + serde_json::from_str(output.trim()).ok() +} + +fn empty() -> GeneratorResults { + GeneratorResults { + suggestions: vec![], + is_ordered: false, + } +} diff --git a/command-signatures/src/generators/fig_teams_latest.rs b/command-signatures/src/generators/fig_teams_latest.rs index 1311ec46..9ea1f363 100644 --- a/command-signatures/src/generators/fig_teams_latest.rs +++ b/command-signatures/src/generators/fig_teams_latest.rs @@ -2,11 +2,37 @@ use super::fig_parse; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("fig-teams@latest").add_generator( - "npx_fig_teams_latest_teams", - Generator::script( - CommandBuilder::single_command("npx -y fig-teams@latest teams ls --json"), - fig_parse::lines, - ), - ) + CommandSignatureGenerators::new("fig-teams@latest") + .add_generator( + "npx_fig_teams_latest_teams", + Generator::script( + CommandBuilder::single_command("npx -y fig-teams@latest teams ls --json"), + fig_parse::json_string_array, + ), + ) + .add_generator( + "npx_fig_teams_latest_users", + Generator::command_from_tokens(users_for_selected_team, fig_parse::json_string_array), + ) +} + +fn users_for_selected_team(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let team = tokens.iter().enumerate().find_map(|(i, token)| { + if (*token == "-t" || *token == "--team") && i + 1 < tokens.len() { + Some(tokens[i + 1]) + } else { + None + } + }); + match team { + Some(team) if !team.is_empty() => CommandBuilder::single_command(format!( + "npx -y fig-teams@latest users get -t {} --json", + shell_single_quote(team) + )), + _ => CommandBuilder::single_command("true"), + } +} + +fn shell_single_quote(value: &str) -> String { + format!("'{}'", value.replace('\'', r"'\''")) } diff --git a/command-signatures/src/generators/fly.rs b/command-signatures/src/generators/fly.rs index a829bd4b..64588ede 100644 --- a/command-signatures/src/generators/fly.rs +++ b/command-signatures/src/generators/fly.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "flyctl_list_apps", Generator::script( CommandBuilder::single_command("flyctl list apps"), - fig_parse::lines, + fig_parse::pipe_table_name_col1_desc, ), ) .add_generator( "flyctl_list_orgs", Generator::script( CommandBuilder::single_command("flyctl list orgs"), - fig_parse::lines, + fig_parse::pipe_table_name_col1_desc, ), ) } diff --git a/command-signatures/src/generators/flyctl.rs b/command-signatures/src/generators/flyctl.rs index 423f0cc0..86449c47 100644 --- a/command-signatures/src/generators/flyctl.rs +++ b/command-signatures/src/generators/flyctl.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "list_apps", Generator::script( CommandBuilder::single_command("flyctl list apps"), - fig_parse::lines, + fig_parse::pipe_table_name_col1_desc, ), ) .add_generator( "list_orgs", Generator::script( CommandBuilder::single_command("flyctl list orgs"), - fig_parse::lines, + fig_parse::pipe_table_name_col1_desc, ), ) } diff --git a/command-signatures/src/generators/fnm.rs b/command-signatures/src/generators/fnm.rs index 1ed3fbd1..b3a52ba5 100644 --- a/command-signatures/src/generators/fnm.rs +++ b/command-signatures/src/generators/fnm.rs @@ -5,13 +5,16 @@ pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("fnm") .add_generator( "ls", - Generator::script(CommandBuilder::single_command("fnm ls"), fig_parse::lines), + Generator::script( + CommandBuilder::single_command("fnm ls"), + fig_parse::slice2_reversed, + ), ) .add_generator( "ls_remote", Generator::script( CommandBuilder::single_command("fnm ls-remote"), - fig_parse::lines, + fig_parse::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/gh.rs b/command-signatures/src/generators/gh.rs index 8a65602a..1973db85 100644 --- a/command-signatures/src/generators/gh.rs +++ b/command-signatures/src/generators/gh.rs @@ -50,7 +50,7 @@ pub fn generator() -> CommandSignatureGenerators { "api_graphql_string_viewer", Generator::script( CommandBuilder::single_command("gh api graphql --paginate -f query='query($endCursor: String) { viewer { repositories(first: 100, after: $endCursor) { nodes { isPrivate, nameWithOwner, description } pageInfo { hasNextPage endCursor }}}}' --jq '.data.viewer.repositories.nodes[]'"), - fig_parse::lines, + fig_parse::json_string_array, ), ) .add_generator( diff --git a/command-signatures/src/generators/git.rs b/command-signatures/src/generators/git.rs index 3d1c69f2..7eae0a32 100644 --- a/command-signatures/src/generators/git.rs +++ b/command-signatures/src/generators/git.rs @@ -1047,7 +1047,7 @@ pub fn generator() -> CommandSignatureGenerators { "log", Generator::script( CommandBuilder::single_command("git --no-optional-locks log --oneline"), - fig_parse::lines, + fig_parse::git_oneline, ), ) .add_generator( diff --git a/command-signatures/src/generators/lerna.rs b/command-signatures/src/generators/lerna.rs index 67fed16d..4554c81a 100644 --- a/command-signatures/src/generators/lerna.rs +++ b/command-signatures/src/generators/lerna.rs @@ -23,7 +23,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( r"lerna list -p | while read p; do \cat $p/package.json && echo END done", ), - fig_parse::lines, + fig_parse::json_script_keys, ), ) .add_generator( diff --git a/command-signatures/src/generators/limactl.rs b/command-signatures/src/generators/limactl.rs index 248ce681..542bb671 100644 --- a/command-signatures/src/generators/limactl.rs +++ b/command-signatures/src/generators/limactl.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("limactl list --quiet"), - fig_parse::lines, + fig_parse::lines_desc_instance, ), ) } diff --git a/command-signatures/src/generators/mosh.rs b/command-signatures/src/generators/mosh.rs index 262e19d1..5eb184c9 100644 --- a/command-signatures/src/generators/mosh.rs +++ b/command-signatures/src/generators/mosh.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_ssh_config", Generator::script( CommandBuilder::single_command("cat ~/.ssh/config"), - fig_parse::lines, + fig_parse::ssh_hosts, ), ) .add_generator( diff --git a/command-signatures/src/generators/npm.rs b/command-signatures/src/generators/npm.rs index 36d70c88..88ed1ace 100644 --- a/command-signatures/src/generators/npm.rs +++ b/command-signatures/src/generators/npm.rs @@ -327,7 +327,7 @@ pub fn pnpm_generators() -> CommandSignatureGenerators { "until_package_json_do_cd", Generator::script( CommandBuilder::single_command("until [[ -f package.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat package.json"), - fig_parse::lines, + fig_parse::json_script_keys, ), ) } diff --git a/command-signatures/src/generators/nr.rs b/command-signatures/src/generators/nr.rs index 4a86e89d..a7ee1c17 100644 --- a/command-signatures/src/generators/nr.rs +++ b/command-signatures/src/generators/nr.rs @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f package.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat package.json", ), - fig_parse::lines, + fig_parse::json_script_keys, ), ) } diff --git a/command-signatures/src/generators/ns.rs b/command-signatures/src/generators/ns.rs index 3a5b79f5..1fe07d95 100644 --- a/command-signatures/src/generators/ns.rs +++ b/command-signatures/src/generators/ns.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "curl_https_api_github_com_repos_nativescript_nativescript_app_templates_contents_packages", Generator::script( CommandBuilder::single_command("curl https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages"), - fig_parse::lines, + fig_parse::json_nativescript_templates, ), ) } diff --git a/command-signatures/src/generators/okteto.rs b/command-signatures/src/generators/okteto.rs index c6e26770..4cfb733d 100644 --- a/command-signatures/src/generators/okteto.rs +++ b/command-signatures/src/generators/okteto.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "context_list", Generator::script( CommandBuilder::single_command("okteto context list"), - fig_parse::lines, + fig_parse::lines_desc_context, ), ) .add_generator( diff --git a/command-signatures/src/generators/pre_commit.rs b/command-signatures/src/generators/pre_commit.rs index 4cfc2b78..e4189517 100644 --- a/command-signatures/src/generators/pre_commit.rs +++ b/command-signatures/src/generators/pre_commit.rs @@ -39,7 +39,7 @@ pub fn generator() -> CommandSignatureGenerators { "git_rev_list", Generator::script( CommandBuilder::single_command("git rev-list --all --oneline"), - fig_parse::lines, + fig_parse::git_oneline, ), ) } diff --git a/command-signatures/src/generators/rush.rs b/command-signatures/src/generators/rush.rs index 687d34af..3b20c08e 100644 --- a/command-signatures/src/generators/rush.rs +++ b/command-signatures/src/generators/rush.rs @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f rush.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat rush.json", ), - fig_parse::lines, + fig_parse::json_rush_projects, ), ) } diff --git a/command-signatures/src/generators/rushx.rs b/command-signatures/src/generators/rushx.rs index 08b3dec0..2dcf31da 100644 --- a/command-signatures/src/generators/rushx.rs +++ b/command-signatures/src/generators/rushx.rs @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f package.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat package.json", ), - fig_parse::lines, + fig_parse::json_script_keys, ), ) } diff --git a/command-signatures/src/generators/sftp.rs b/command-signatures/src/generators/sftp.rs index 9af58fc9..fef6808d 100644 --- a/command-signatures/src/generators/sftp.rs +++ b/command-signatures/src/generators/sftp.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_ssh_config", Generator::script( CommandBuilder::single_command("cat ~/.ssh/config"), - fig_parse::lines, + fig_parse::ssh_hosts, ), ) .add_generator( diff --git a/command-signatures/src/generators/trex.rs b/command-signatures/src/generators/trex.rs index 5dd5ee95..5a2d7762 100644 --- a/command-signatures/src/generators/trex.rs +++ b/command-signatures/src/generators/trex.rs @@ -14,7 +14,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_run_json", Generator::script( CommandBuilder::single_command("cat run.json"), - fig_parse::lines, + fig_parse::json_script_keys, ), ) } diff --git a/command-signatures/src/generators/vr.rs b/command-signatures/src/generators/vr.rs index e822c96f..18e7ffbf 100644 --- a/command-signatures/src/generators/vr.rs +++ b/command-signatures/src/generators/vr.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("NO_COLOR=1 vr"), - fig_parse::lines, + fig_parse::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/watson.rs b/command-signatures/src/generators/watson.rs index e15c0d2e..ade3a72c 100644 --- a/command-signatures/src/generators/watson.rs +++ b/command-signatures/src/generators/watson.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "log", Generator::script( CommandBuilder::single_command("watson log --json --reverse"), - fig_parse::lines, + fig_parse::json_string_array, ), ) .add_generator( diff --git a/command-signatures/src/generators/wd.rs b/command-signatures/src/generators/wd.rs index 88823334..03eff225 100644 --- a/command-signatures/src/generators/wd.rs +++ b/command-signatures/src/generators/wd.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_warprc", Generator::script( CommandBuilder::single_command("cat ~/.warprc"), - fig_parse::lines, + fig_parse::lines_desc_warp_point, ), ) } From e3a5a38019d42e886157c8a0d4ad357d711b182d Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 18:32:59 +0000 Subject: [PATCH 02/20] Port recovered Fig template filters Add shared file/folder filters for Python, YAML playbooks, direnv .envrc, and ts-node tsconfig, recovered from original Fig filepaths generators. --- command-signatures/json/ansible-playbook.json | 3 +- command-signatures/json/direnv.json | 3 + command-signatures/json/limactl.json | 1 + command-signatures/json/python.json | 1 + command-signatures/json/python3.json | 1 + command-signatures/json/ts-node.json | 3 +- .../src/generators/ansible_playbook.rs | 7 ++ command-signatures/src/generators/direnv.rs | 6 ++ .../src/generators/fig_filters.rs | 69 +++++++++++++++++++ command-signatures/src/generators/limactl.rs | 18 ++--- command-signatures/src/generators/mod.rs | 10 +++ command-signatures/src/generators/python.rs | 10 +++ command-signatures/src/generators/ts_node.rs | 7 ++ 13 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 command-signatures/src/generators/ansible_playbook.rs create mode 100644 command-signatures/src/generators/direnv.rs create mode 100644 command-signatures/src/generators/fig_filters.rs create mode 100644 command-signatures/src/generators/python.rs create mode 100644 command-signatures/src/generators/ts_node.rs diff --git a/command-signatures/json/ansible-playbook.json b/command-signatures/json/ansible-playbook.json index d77abba0..de2b9f9f 100644 --- a/command-signatures/json/ansible-playbook.json +++ b/command-signatures/json/ansible-playbook.json @@ -5,7 +5,8 @@ "name": "playbook", "description": "Playbook(s)", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" }, "options": [ { diff --git a/command-signatures/json/direnv.json b/command-signatures/json/direnv.json index 9ec35ecc..a232ea04 100644 --- a/command-signatures/json/direnv.json +++ b/command-signatures/json/direnv.json @@ -9,6 +9,7 @@ "args": { "name": "PATH_TO_RC", "template": "filepaths", + "filterTemplateName": "filter-envrc", "isOptional": true } }, @@ -19,6 +20,7 @@ "args": { "name": "PATH_TO_RC", "template": "filepaths", + "filterTemplateName": "filter-envrc", "isOptional": true } }, @@ -28,6 +30,7 @@ "args": { "name": "PATH_TO_RC", "template": "filepaths", + "filterTemplateName": "filter-envrc", "isOptional": true } }, diff --git a/command-signatures/json/limactl.json b/command-signatures/json/limactl.json index 7c6adc92..4612c7ae 100644 --- a/command-signatures/json/limactl.json +++ b/command-signatures/json/limactl.json @@ -337,6 +337,7 @@ "args": { "name": "NAME|FILE.yaml|URL", "template": "filepaths", + "filterTemplateName": "filter-yml-yaml", "generatorName": "list" }, "options": [ diff --git a/command-signatures/json/python.json b/command-signatures/json/python.json index 0b4c1c40..6daba112 100644 --- a/command-signatures/json/python.json +++ b/command-signatures/json/python.json @@ -7,6 +7,7 @@ "name": "python script", "isScript": true, "template": "filepaths", + "filterTemplateName": "filter-py", "skipGeneratorValidation": false }, "options": [ diff --git a/command-signatures/json/python3.json b/command-signatures/json/python3.json index a5da1b6a..990c9625 100644 --- a/command-signatures/json/python3.json +++ b/command-signatures/json/python3.json @@ -7,6 +7,7 @@ "name": "python script", "isScript": true, "template": "filepaths", + "filterTemplateName": "filter-py", "skipGeneratorValidation": false }, "options": [ diff --git a/command-signatures/json/ts-node.json b/command-signatures/json/ts-node.json index 4082dc41..44b752e4 100644 --- a/command-signatures/json/ts-node.json +++ b/command-signatures/json/ts-node.json @@ -93,7 +93,8 @@ "description": "Specify TypeScript project location", "args": { "name": "project", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-tsconfig" } }, { diff --git a/command-signatures/src/generators/ansible_playbook.rs b/command-signatures/src/generators/ansible_playbook.rs new file mode 100644 index 00000000..635ef020 --- /dev/null +++ b/command-signatures/src/generators/ansible_playbook.rs @@ -0,0 +1,7 @@ +use super::fig_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("ansible-playbook") + .add_filter("filter-yml-yaml", fig_filters::yml_yaml()) +} diff --git a/command-signatures/src/generators/direnv.rs b/command-signatures/src/generators/direnv.rs new file mode 100644 index 00000000..3aa718fe --- /dev/null +++ b/command-signatures/src/generators/direnv.rs @@ -0,0 +1,6 @@ +use super::fig_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("direnv").add_filter("filter-envrc", fig_filters::envrc()) +} diff --git a/command-signatures/src/generators/fig_filters.rs b/command-signatures/src/generators/fig_filters.rs new file mode 100644 index 00000000..bff628fa --- /dev/null +++ b/command-signatures/src/generators/fig_filters.rs @@ -0,0 +1,69 @@ +use warp_completion_metadata::{ + Importance, Order, PathSuggestionType, Priority, Suggestion, TemplateFilter, +}; + +pub fn py() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["py"])) +} + +pub fn yml_yaml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["yml", "yaml"])) +} + +pub fn envrc() -> TemplateFilter { + TemplateFilter(|mut suggestion, path_type| { + let is_envrc = suggestion.exact_string.contains(".envrc"); + if path_type.is_folder() || is_envrc { + if is_envrc { + suggestion.priority = Priority::Global(Importance::More(Order(76))); + } + Some(suggestion) + } else { + None + } + }) +} + +pub fn tsconfig_json() -> TemplateFilter { + TemplateFilter(|mut suggestion, path_type| { + let name = suggestion.exact_string.as_str(); + let is_json = name.ends_with(".json") || name.ends_with(".json/"); + if path_type.is_folder() || is_json { + if name.ends_with("tsconfig.json") || name.ends_with("tsconfig.json/") { + suggestion.priority = Priority::Global(Importance::More(Order(100))); + } else if is_json { + suggestion.priority = Priority::Global(Importance::More(Order(76))); + } + Some(suggestion) + } else { + None + } + }) +} + +#[allow(dead_code)] +pub fn xcodeproj() -> TemplateFilter { + TemplateFilter(|mut suggestion, _path_type| { + if suggestion.exact_string.ends_with(".xcodeproj/") + || suggestion.exact_string.ends_with(".xcodeproj") + { + suggestion.priority = Priority::Global(Importance::More(Order(76))); + } + Some(suggestion) + }) +} + +fn folders_or_ext( + suggestion: Suggestion, + path_type: PathSuggestionType, + extensions: &[&str], +) -> Option { + if path_type.is_folder() { + return Some(suggestion); + } + let name = suggestion.exact_string.to_ascii_lowercase(); + extensions + .iter() + .any(|ext| name.ends_with(&format!(".{ext}")) || name.ends_with(&format!(".{ext}/"))) + .then_some(suggestion) +} diff --git a/command-signatures/src/generators/limactl.rs b/command-signatures/src/generators/limactl.rs index 542bb671..2432c3d4 100644 --- a/command-signatures/src/generators/limactl.rs +++ b/command-signatures/src/generators/limactl.rs @@ -1,12 +1,14 @@ -use super::fig_parse; +use super::{fig_filters, fig_parse}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("limactl").add_generator( - "list", - Generator::script( - CommandBuilder::single_command("limactl list --quiet"), - fig_parse::lines_desc_instance, - ), - ) + CommandSignatureGenerators::new("limactl") + .add_generator( + "list", + Generator::script( + CommandBuilder::single_command("limactl list --quiet"), + fig_parse::lines_desc_instance, + ), + ) + .add_filter("filter-yml-yaml", fig_filters::yml_yaml()) } diff --git a/command-signatures/src/generators/mod.rs b/command-signatures/src/generators/mod.rs index d6a47cc3..7410d715 100644 --- a/command-signatures/src/generators/mod.rs +++ b/command-signatures/src/generators/mod.rs @@ -4,6 +4,7 @@ use warp_completion_metadata::DynamicCompletionData; mod amplify; mod ansible_doc; +mod ansible_playbook; mod assimp; mod autojump; mod bat; @@ -16,6 +17,7 @@ mod cordova; mod deno; mod deployctl; mod deta; +mod direnv; mod dtm; mod eb; mod elm; @@ -24,6 +26,7 @@ mod eslint; mod expo; mod expo_cli; mod ffmpeg; +mod fig_filters; mod fig_parse; mod fig_teams_latest; mod fisher; @@ -55,6 +58,7 @@ mod open; mod pandoc; mod pre_commit; mod projj; +mod python; mod quickmail; mod r; mod rancher; @@ -77,6 +81,7 @@ mod tfenv; mod tfsec; mod tokei; mod trex; +mod ts_node; mod turbo; mod vite; mod vr; @@ -214,6 +219,8 @@ pub fn dynamic_command_signature_data() -> HashMap HashMap HashMap HashMap CommandSignatureGenerators { + CommandSignatureGenerators::new("python").add_filter("filter-py", fig_filters::py()) +} + +pub fn python3_generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("python3").add_filter("filter-py", fig_filters::py()) +} diff --git a/command-signatures/src/generators/ts_node.rs b/command-signatures/src/generators/ts_node.rs new file mode 100644 index 00000000..561adffa --- /dev/null +++ b/command-signatures/src/generators/ts_node.rs @@ -0,0 +1,7 @@ +use super::fig_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("ts-node") + .add_filter("filter-tsconfig", fig_filters::tsconfig_json()) +} From cdecb5f64e3708b76167b1b905145d01671d61f2 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 18:45:29 +0000 Subject: [PATCH 03/20] Rename Fig helper modules and add token-aware generators Rename fig_parse/fig_filters/fig_teams_latest to output_parsers, template_filters, and fig_teams. Use semantic generator names for Teams users/teams. Add token-aware generators for cargo, docker, gh, apt, bun, trivy, chown, and related commands. --- command-signatures/json/deno.json | 4 +- command-signatures/json/deployctl.json | 2 +- command-signatures/json/elm.json | 2 +- command-signatures/json/fig-teams.json | 10 +- command-signatures/json/nativescript.json | 2 +- command-signatures/json/ns.json | 2 +- command-signatures/json/rustup.json | 2 +- command-signatures/json/stepzen.json | 2 +- command-signatures/json/tns.json | 2 +- command-signatures/src/generators/amplify.rs | 4 +- .../src/generators/ansible_doc.rs | 4 +- .../src/generators/ansible_playbook.rs | 4 +- command-signatures/src/generators/apt.rs | 13 +- command-signatures/src/generators/assimp.rs | 6 +- command-signatures/src/generators/autojump.rs | 4 +- command-signatures/src/generators/bat.rs | 16 +- command-signatures/src/generators/black.rs | 4 +- command-signatures/src/generators/brew.rs | 4 + command-signatures/src/generators/bun.rs | 7 + command-signatures/src/generators/cargo.rs | 15 +- command-signatures/src/generators/checkov.rs | 4 +- command-signatures/src/generators/chown.rs | 9 + command-signatures/src/generators/cmd_n.rs | 4 +- command-signatures/src/generators/copilot.rs | 4 +- command-signatures/src/generators/cordova.rs | 6 +- command-signatures/src/generators/deno.rs | 19 +- .../src/generators/deployctl.rs | 6 +- command-signatures/src/generators/deta.rs | 4 +- command-signatures/src/generators/direnv.rs | 4 +- command-signatures/src/generators/docker.rs | 8 + command-signatures/src/generators/dtm.rs | 4 +- command-signatures/src/generators/eb.rs | 4 +- command-signatures/src/generators/elm.rs | 6 +- .../src/generators/elm_review.rs | 7 +- command-signatures/src/generators/eslint.rs | 8 +- command-signatures/src/generators/expo.rs | 8 +- command-signatures/src/generators/expo_cli.rs | 8 +- command-signatures/src/generators/ffmpeg.rs | 6 +- .../{fig_teams_latest.rs => fig_teams.rs} | 13 +- .../src/generators/fig_token.rs | 275 ++++++++++++++++++ command-signatures/src/generators/fisher.rs | 4 +- command-signatures/src/generators/fly.rs | 6 +- command-signatures/src/generators/flyctl.rs | 6 +- command-signatures/src/generators/fnm.rs | 6 +- command-signatures/src/generators/fvm.rs | 4 +- command-signatures/src/generators/gh.rs | 10 +- command-signatures/src/generators/git.rs | 19 +- command-signatures/src/generators/gpg.rs | 4 +- command-signatures/src/generators/hexo.rs | 4 +- command-signatures/src/generators/hugo.rs | 4 +- command-signatures/src/generators/hyper.rs | 4 +- command-signatures/src/generators/id.rs | 4 +- .../src/generators/ignite_cli.rs | 4 +- command-signatures/src/generators/kool.rs | 6 +- command-signatures/src/generators/lerna.rs | 13 +- command-signatures/src/generators/limactl.rs | 6 +- command-signatures/src/generators/mackup.rs | 4 +- command-signatures/src/generators/mdfind.rs | 4 +- command-signatures/src/generators/meteor.rs | 8 +- command-signatures/src/generators/mix.rs | 7 +- command-signatures/src/generators/mod.rs | 13 +- command-signatures/src/generators/mosh.rs | 6 +- .../src/generators/networkquality.rs | 4 +- command-signatures/src/generators/npm.rs | 11 +- command-signatures/src/generators/npx.rs | 4 +- command-signatures/src/generators/nr.rs | 4 +- command-signatures/src/generators/ns.rs | 6 +- command-signatures/src/generators/nx.rs | 4 + command-signatures/src/generators/okteto.rs | 6 +- command-signatures/src/generators/op.rs | 4 +- command-signatures/src/generators/open.rs | 6 +- .../{fig_parse.rs => output_parsers.rs} | 71 +++++ command-signatures/src/generators/pandoc.rs | 8 +- .../src/generators/pre_commit.rs | 12 +- command-signatures/src/generators/projj.rs | 6 +- command-signatures/src/generators/python.rs | 6 +- .../src/generators/quickmail.rs | 4 +- command-signatures/src/generators/r.rs | 4 +- command-signatures/src/generators/rancher.rs | 4 +- command-signatures/src/generators/rclone.rs | 4 +- command-signatures/src/generators/redwood.rs | 4 +- command-signatures/src/generators/robot.rs | 4 +- command-signatures/src/generators/rush.rs | 4 +- command-signatures/src/generators/rushx.rs | 4 +- command-signatures/src/generators/rustup.rs | 6 +- command-signatures/src/generators/scc.rs | 4 +- command-signatures/src/generators/sftp.rs | 6 +- .../src/generators/shortcuts.rs | 6 +- .../src/generators/softwareupdate.rs | 4 +- command-signatures/src/generators/stepzen.rs | 8 +- command-signatures/src/generators/sysctl.rs | 4 +- .../src/generators/tailscale.rs | 4 +- command-signatures/src/generators/tccutil.rs | 4 +- .../{fig_filters.rs => template_filters.rs} | 0 .../src/generators/terragrunt.rs | 6 +- command-signatures/src/generators/tfenv.rs | 6 +- command-signatures/src/generators/tfsec.rs | 4 +- command-signatures/src/generators/tokei.rs | 4 +- command-signatures/src/generators/trex.rs | 6 +- command-signatures/src/generators/trivy.rs | 27 ++ command-signatures/src/generators/ts_node.rs | 4 +- command-signatures/src/generators/turbo.rs | 6 +- command-signatures/src/generators/vite.rs | 4 +- command-signatures/src/generators/vr.rs | 4 +- command-signatures/src/generators/vsce.rs | 4 +- .../src/generators/vultr_cli.rs | 4 +- command-signatures/src/generators/watson.rs | 8 +- command-signatures/src/generators/wd.rs | 4 +- .../src/generators/wifi_password.rs | 4 +- command-signatures/src/generators/yo.rs | 4 +- .../src/generators/youtube_dl.rs | 21 +- 111 files changed, 746 insertions(+), 266 deletions(-) create mode 100644 command-signatures/src/generators/chown.rs rename command-signatures/src/generators/{fig_teams_latest.rs => fig_teams.rs} (78%) create mode 100644 command-signatures/src/generators/fig_token.rs rename command-signatures/src/generators/{fig_parse.rs => output_parsers.rs} (78%) rename command-signatures/src/generators/{fig_filters.rs => template_filters.rs} (100%) create mode 100644 command-signatures/src/generators/trivy.rs diff --git a/command-signatures/json/deno.json b/command-signatures/json/deno.json index 52a52738..d8e5a43e 100644 --- a/command-signatures/json/deno.json +++ b/command-signatures/json/deno.json @@ -2150,7 +2150,7 @@ ], "args": { "name": "name", - "generatorName": "find_deno_bin_1_f" + "generatorName": "deno_binaries" } }, { @@ -3404,7 +3404,7 @@ "args": { "name": "version", "isOptional": true, - "generatorName": "curl_https_cdn_deno_land_deno_meta_versions_json" + "generatorName": "deno_versions" } }, { diff --git a/command-signatures/json/deployctl.json b/command-signatures/json/deployctl.json index d6c5ddb5..4c4f2d82 100644 --- a/command-signatures/json/deployctl.json +++ b/command-signatures/json/deployctl.json @@ -59,7 +59,7 @@ "args": { "name": "version", "isOptional": true, - "generatorName": "curl_https_cdn_deno_land_deploy_meta_versions_json" + "generatorName": "deploy_versions" } } ], diff --git a/command-signatures/json/elm.json b/command-signatures/json/elm.json index 6cf5c408..893465d3 100644 --- a/command-signatures/json/elm.json +++ b/command-signatures/json/elm.json @@ -58,7 +58,7 @@ "name": "package", "description": "The name of the package to install", "debounce": true, - "generatorName": "curl_accept_encoding_gzip_https_package_elm_lang_org_search_json" + "generatorName": "elm_packages" }, "options": [ { diff --git a/command-signatures/json/fig-teams.json b/command-signatures/json/fig-teams.json index ff5b0a6e..5ed4fa55 100644 --- a/command-signatures/json/fig-teams.json +++ b/command-signatures/json/fig-teams.json @@ -34,7 +34,7 @@ "description": "Team to use", "args": { "name": "teamname", - "generatorName": "npx_fig_teams_latest_teams" + "generatorName": "teams_list" } }, { @@ -55,13 +55,13 @@ "description": "Team to use", "args": { "name": "teamname", - "generatorName": "npx_fig_teams_latest_teams" + "generatorName": "teams_list" } } ], "args": { "name": "email", - "generatorName": "npx_fig_teams_latest_users" + "generatorName": "users_for_selected_team" } }, { @@ -76,13 +76,13 @@ "description": "Team to use", "args": { "name": "teamname", - "generatorName": "npx_fig_teams_latest_teams" + "generatorName": "teams_list" } } ], "args": { "name": "email", - "generatorName": "npx_fig_teams_latest_users" + "generatorName": "users_for_selected_team" } } ] diff --git a/command-signatures/json/nativescript.json b/command-signatures/json/nativescript.json index dc169d36..7de73f1c 100644 --- a/command-signatures/json/nativescript.json +++ b/command-signatures/json/nativescript.json @@ -237,7 +237,7 @@ "description": "Create a project using a predefined template", "args": { "name": "template", - "generatorName": "curl_https_api_github_com_repos_nativescript_nativescript_app_templates_contents_packages" + "generatorName": "nativescript_templates" } }, { diff --git a/command-signatures/json/ns.json b/command-signatures/json/ns.json index dc169d36..7de73f1c 100644 --- a/command-signatures/json/ns.json +++ b/command-signatures/json/ns.json @@ -237,7 +237,7 @@ "description": "Create a project using a predefined template", "args": { "name": "template", - "generatorName": "curl_https_api_github_com_repos_nativescript_nativescript_app_templates_contents_packages" + "generatorName": "nativescript_templates" } }, { diff --git a/command-signatures/json/rustup.json b/command-signatures/json/rustup.json index c5fdc1e3..3a89c756 100644 --- a/command-signatures/json/rustup.json +++ b/command-signatures/json/rustup.json @@ -676,7 +676,7 @@ "args": { "name": "", "description": "Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc", - "generatorName": "find_docs_s_index_html" + "generatorName": "rustup_docs" } }, { diff --git a/command-signatures/json/stepzen.json b/command-signatures/json/stepzen.json index 77e1d83e..3bf5700f 100644 --- a/command-signatures/json/stepzen.json +++ b/command-signatures/json/stepzen.json @@ -59,7 +59,7 @@ "args": { "name": "name", "description": "The name of the generator to import", - "generatorName": "curl_https_api_github_com_repos_steprz_stepzen_schemas_contents" + "generatorName": "github_schemas" }, "options": [ { diff --git a/command-signatures/json/tns.json b/command-signatures/json/tns.json index dc169d36..7de73f1c 100644 --- a/command-signatures/json/tns.json +++ b/command-signatures/json/tns.json @@ -237,7 +237,7 @@ "description": "Create a project using a predefined template", "args": { "name": "template", - "generatorName": "curl_https_api_github_com_repos_nativescript_nativescript_app_templates_contents_packages" + "generatorName": "nativescript_templates" } }, { diff --git a/command-signatures/src/generators/amplify.rs b/command-signatures/src/generators/amplify.rs index 3141dccf..b9a84de6 100644 --- a/command-signatures/src/generators/amplify.rs +++ b/command-signatures/src/generators/amplify.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "env_list", Generator::script( CommandBuilder::single_command("amplify env list --json"), - fig_parse::json_envs, + output_parsers::json_envs, ), ) } diff --git a/command-signatures/src/generators/ansible_doc.rs b/command-signatures/src/generators/ansible_doc.rs index b3ba2235..4a82ef33 100644 --- a/command-signatures/src/generators/ansible_doc.rs +++ b/command-signatures/src/generators/ansible_doc.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("ansible-doc --list --json 2>/dev/null"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/ansible_playbook.rs b/command-signatures/src/generators/ansible_playbook.rs index 635ef020..3d3c41f4 100644 --- a/command-signatures/src/generators/ansible_playbook.rs +++ b/command-signatures/src/generators/ansible_playbook.rs @@ -1,7 +1,7 @@ -use super::fig_filters; +use super::template_filters; use warp_completion_metadata::CommandSignatureGenerators; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("ansible-playbook") - .add_filter("filter-yml-yaml", fig_filters::yml_yaml()) + .add_filter("filter-yml-yaml", template_filters::yml_yaml()) } diff --git a/command-signatures/src/generators/apt.rs b/command-signatures/src/generators/apt.rs index 0b4bed43..e4199a51 100644 --- a/command-signatures/src/generators/apt.rs +++ b/command-signatures/src/generators/apt.rs @@ -1,5 +1,5 @@ /// Used for debian-based package managers like apt-get, aptitude, etc. -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{ CommandBuilder, CommandSignatureGenerators, Generator, GeneratorResults, GeneratorResultsCollector, Priority, Suggestion, @@ -106,14 +106,21 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("apt list --installed"), - fig_parse::apt_package_before_slash, + output_parsers::apt_package_before_slash, ), ) .add_generator( "list_upgradable", Generator::script( CommandBuilder::single_command("apt list --upgradable"), - fig_parse::apt_package_before_slash, + output_parsers::apt_package_before_slash, + ), + ) + .add_generator( + "list_prefix", + Generator::command_from_tokens( + super::fig_token::apt_list_prefix, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/assimp.rs b/command-signatures/src/generators/assimp.rs index 94c7841a..8c02ef58 100644 --- a/command-signatures/src/generators/assimp.rs +++ b/command-signatures/src/generators/assimp.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "listexport", Generator::script( CommandBuilder::single_command("assimp listexport"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "listext", Generator::script( CommandBuilder::single_command("assimp listext"), - fig_parse::lines_desc_extension, + output_parsers::lines_desc_extension, ), ) } diff --git a/command-signatures/src/generators/autojump.rs b/command-signatures/src/generators/autojump.rs index a5aa91d0..56c9b37e 100644 --- a/command-signatures/src/generators/autojump.rs +++ b/command-signatures/src/generators/autojump.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat", Generator::script( CommandBuilder::single_command(r#"cat "$HOME"/Library/autojump/autojump.txt"#), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/bat.rs b/command-signatures/src/generators/bat.rs index 95a884fe..124756d5 100644 --- a/command-signatures/src/generators/bat.rs +++ b/command-signatures/src/generators/bat.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("bat --list-themes"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "completions_bat", Generator::script( CommandBuilder::single_command("bat --list-languages"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -23,7 +23,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --paging unknow 2>&1 >/dev/null | grep possible", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -32,7 +32,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --decorations unknow 2>&1 >/dev/null | grep possible", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -41,7 +41,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --color unknow 2>&1 >/dev/null | grep possible", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -50,7 +50,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --italic-text unknow 2>&1 >/dev/null | grep possible", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -59,7 +59,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --wrap unknow 2>&1 >/dev/null | grep possible", ), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/black.rs b/command-signatures/src/generators/black.rs index 1de6a599..7c2c57dd 100644 --- a/command-signatures/src/generators/black.rs +++ b/command-signatures/src/generators/black.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "gh_release_list_psf_black", Generator::script( CommandBuilder::single_command("gh release list --repo psf/black"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/brew.rs b/command-signatures/src/generators/brew.rs index 434491f5..4a8450cc 100644 --- a/command-signatures/src/generators/brew.rs +++ b/command-signatures/src/generators/brew.rs @@ -94,6 +94,10 @@ pub fn generator() -> CommandSignatureGenerators { "repositories_generator", Generator::script(CommandBuilder::single_command("brew tap"), post_process), ) + .add_generator( + "gist_logs_actions", + Generator::command_from_tokens(super::fig_token::brew_gist_logs_actions, post_process), + ) } fn post_process(output: &str) -> GeneratorResults { diff --git a/command-signatures/src/generators/bun.rs b/command-signatures/src/generators/bun.rs index 87348ebf..1ca2e062 100644 --- a/command-signatures/src/generators/bun.rs +++ b/command-signatures/src/generators/bun.rs @@ -6,6 +6,13 @@ pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("bun") .add_generator("get_scripts_generator", get_scripts_generator()) .add_generator("dependencies_generator", dependencies_generator()) + .add_generator( + "npms_search", + warp_completion_metadata::Generator::command_from_tokens( + crate::generators::fig_token::npms_search, + crate::generators::output_parsers::npms_search_results, + ), + ) } #[cfg(test)] diff --git a/command-signatures/src/generators/cargo.rs b/command-signatures/src/generators/cargo.rs index 7606ad22..73df07df 100644 --- a/command-signatures/src/generators/cargo.rs +++ b/command-signatures/src/generators/cargo.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::{fig_token, output_parsers}; use std::collections::{HashMap, HashSet}; use warp_completion_metadata::{ @@ -157,7 +157,18 @@ pub fn generator() -> CommandSignatureGenerators { "read_manifest", Generator::script( CommandBuilder::single_command("cargo read-manifest"), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) + .add_generator( + "crates_io_search", + Generator::command_from_tokens( + fig_token::crates_io_search, + output_parsers::json_crates, + ), + ) + .add_generator( + "test_list", + Generator::command_from_tokens(fig_token::cargo_test_list, output_parsers::lines), + ) } diff --git a/command-signatures/src/generators/checkov.rs b/command-signatures/src/generators/checkov.rs index e9fa8024..cb380e39 100644 --- a/command-signatures/src/generators/checkov.rs +++ b/command-signatures/src/generators/checkov.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "git_branch", Generator::script( CommandBuilder::single_command("git branch --no-color"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/chown.rs b/command-signatures/src/generators/chown.rs new file mode 100644 index 00000000..070ce7a2 --- /dev/null +++ b/command-signatures/src/generators/chown.rs @@ -0,0 +1,9 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("chown").add_generator( + "users_or_groups", + Generator::command_from_tokens(fig_token::chown_dscl, output_parsers::lines), + ) +} diff --git a/command-signatures/src/generators/cmd_n.rs b/command-signatures/src/generators/cmd_n.rs index 0e1783c3..2be7586b 100644 --- a/command-signatures/src/generators/cmd_n.rs +++ b/command-signatures/src/generators/cmd_n.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "lsr", Generator::script( CommandBuilder::single_command("n lsr --all"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/copilot.rs b/command-signatures/src/generators/copilot.rs index 7863d930..0fddc183 100644 --- a/command-signatures/src/generators/copilot.rs +++ b/command-signatures/src/generators/copilot.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_copilot_workspace", Generator::script( CommandBuilder::single_command("cat copilot/.workspace"), - fig_parse::yaml_application, + output_parsers::yaml_application, ), ) } diff --git a/command-signatures/src/generators/cordova.rs b/command-signatures/src/generators/cordova.rs index 8b050c09..0b954606 100644 --- a/command-signatures/src/generators/cordova.rs +++ b/command-signatures/src/generators/cordova.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "cat_package_json", Generator::script( CommandBuilder::single_command("cat package.json"), - fig_parse::json_cordova_platforms, + output_parsers::json_cordova_platforms, ), ) .add_generator( "plugin_list", Generator::script( CommandBuilder::single_command("cordova plugin list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/deno.rs b/command-signatures/src/generators/deno.rs index 95f58ed4..d76ab493 100644 --- a/command-signatures/src/generators/deno.rs +++ b/command-signatures/src/generators/deno.rs @@ -1,29 +1,36 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("deno") .add_generator( - "curl_https_cdn_deno_land_deno_meta_versions_json", + "deno_versions", Generator::script( CommandBuilder::single_command( "curl -sL 'https://cdn.deno.land/deno/meta/versions.json'", ), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) .add_generator( - "find_deno_bin_1_f", + "deno_binaries", Generator::script( CommandBuilder::single_command(r"\find ~/.deno/bin -maxdepth 1 -perm -111 -type f"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "lint", Generator::script( CommandBuilder::single_command("deno lint --rules --json"), - fig_parse::json_deno_codes, + output_parsers::json_deno_codes, + ), + ) + .add_generator( + "doc_json", + Generator::command_from_tokens( + super::fig_token::deno_doc_json, + output_parsers::json_string_array, ), ) } diff --git a/command-signatures/src/generators/deployctl.rs b/command-signatures/src/generators/deployctl.rs index 70a04017..8c5bfdfe 100644 --- a/command-signatures/src/generators/deployctl.rs +++ b/command-signatures/src/generators/deployctl.rs @@ -1,14 +1,14 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("deployctl").add_generator( - "curl_https_cdn_deno_land_deploy_meta_versions_json", + "deploy_versions", Generator::script( CommandBuilder::single_command( "curl -sL 'https://cdn.deno.land/deploy/meta/versions.json'", ), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) } diff --git a/command-signatures/src/generators/deta.rs b/command-signatures/src/generators/deta.rs index f39b689f..83f82af3 100644 --- a/command-signatures/src/generators/deta.rs +++ b/command-signatures/src/generators/deta.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "node12_node14_python3_7_python3", Generator::script( CommandBuilder::single_command("echo node12, node14, python3.7, python3.9"), - fig_parse::lines_desc_runtime, + output_parsers::lines_desc_runtime, ), ) } diff --git a/command-signatures/src/generators/direnv.rs b/command-signatures/src/generators/direnv.rs index 3aa718fe..a8c2cb09 100644 --- a/command-signatures/src/generators/direnv.rs +++ b/command-signatures/src/generators/direnv.rs @@ -1,6 +1,6 @@ -use super::fig_filters; +use super::template_filters; use warp_completion_metadata::CommandSignatureGenerators; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("direnv").add_filter("filter-envrc", fig_filters::envrc()) + CommandSignatureGenerators::new("direnv").add_filter("filter-envrc", template_filters::envrc()) } diff --git a/command-signatures/src/generators/docker.rs b/command-signatures/src/generators/docker.rs index e29e059e..75826b40 100644 --- a/command-signatures/src/generators/docker.rs +++ b/command-signatures/src/generators/docker.rs @@ -483,4 +483,12 @@ pub fn generator() -> CommandSignatureGenerators { .then_some(suggestion) }), ) + .add_generator( + "from_as", + Generator::command_from_tokens(super::fig_token::docker_from_as, super::output_parsers::docker_from_as_names), + ) + .add_generator( + "search", + Generator::command_from_tokens(super::fig_token::docker_search, super::output_parsers::lines), + ) } diff --git a/command-signatures/src/generators/dtm.rs b/command-signatures/src/generators/dtm.rs index 4514c617..0b1883b4 100644 --- a/command-signatures/src/generators/dtm.rs +++ b/command-signatures/src/generators/dtm.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list_plugins", Generator::script( CommandBuilder::single_command("dtm list plugins"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/eb.rs b/command-signatures/src/generators/eb.rs index 29cab9ac..f36835d4 100644 --- a/command-signatures/src/generators/eb.rs +++ b/command-signatures/src/generators/eb.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("eb list"), - fig_parse::strip_star_prefix, + output_parsers::strip_star_prefix, ), ) } diff --git a/command-signatures/src/generators/elm.rs b/command-signatures/src/generators/elm.rs index b4d69344..879c0d5d 100644 --- a/command-signatures/src/generators/elm.rs +++ b/command-signatures/src/generators/elm.rs @@ -1,13 +1,13 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("elm") .add_generator( - "curl_accept_encoding_gzip_https_package_elm_lang_org_search_json", + "elm_packages", Generator::script( CommandBuilder::single_command("curl -sH 'accept-encoding: gzip' https://package.elm-lang.org/search.json | gunzip"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/elm_review.rs b/command-signatures/src/generators/elm_review.rs index 6a59617d..3b3d7ffc 100644 --- a/command-signatures/src/generators/elm_review.rs +++ b/command-signatures/src/generators/elm_review.rs @@ -1,9 +1,12 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("elm-review").add_generator( "echo", - Generator::script(CommandBuilder::single_command("echo"), fig_parse::lines), + Generator::script( + CommandBuilder::single_command("echo"), + output_parsers::lines, + ), ) } diff --git a/command-signatures/src/generators/eslint.rs b/command-signatures/src/generators/eslint.rs index ba6a1f03..8bd1b7a6 100644 --- a/command-signatures/src/generators/eslint.rs +++ b/command-signatures/src/generators/eslint.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,7 +7,11 @@ pub fn generator() -> CommandSignatureGenerators { "ls_node_modules_root_global", Generator::script( CommandBuilder::single_command("{ ls node_modules ; ls $(npm root -g) ; ls $(yarn global dir)/node_modules/ ; } | cat"), - fig_parse::lines, + output_parsers::lines, ), ) + .add_generator( + "env_remaining", + Generator::command_from_tokens(super::fig_token::eslint_env_remaining, output_parsers::lines), + ) } diff --git a/command-signatures/src/generators/expo.rs b/command-signatures/src/generators/expo.rs index 2f9b105b..5b291442 100644 --- a/command-signatures/src/generators/expo.rs +++ b/command-signatures/src/generators/expo.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,21 +7,21 @@ pub fn generator() -> CommandSignatureGenerators { "sysctl_hw_ncpu", Generator::script( CommandBuilder::single_command("sysctl -n hw.ncpu"), - fig_parse::descending_count, + output_parsers::descending_count, ), ) .add_generator( "xcodebuild_ios_xcodeproj", Generator::script( CommandBuilder::single_command("xcodebuild -project ios/*.xcodeproj -list -json"), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) .add_generator( "xcrun_xctrace_list_devices", Generator::script( CommandBuilder::single_command("xcrun xctrace list devices"), - fig_parse::second_whitespace_token, + output_parsers::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/expo_cli.rs b/command-signatures/src/generators/expo_cli.rs index 2e371806..4ab61d21 100644 --- a/command-signatures/src/generators/expo_cli.rs +++ b/command-signatures/src/generators/expo_cli.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,21 +7,21 @@ pub fn generator() -> CommandSignatureGenerators { "sysctl_hw_ncpu", Generator::script( CommandBuilder::single_command("sysctl -n hw.ncpu"), - fig_parse::descending_count, + output_parsers::descending_count, ), ) .add_generator( "xcodebuild_ios_xcodeproj", Generator::script( CommandBuilder::single_command("xcodebuild -project ios/*.xcodeproj -list -json"), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) .add_generator( "xcrun_xctrace_list_devices", Generator::script( CommandBuilder::single_command("xcrun xctrace list devices"), - fig_parse::second_whitespace_token, + output_parsers::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/ffmpeg.rs b/command-signatures/src/generators/ffmpeg.rs index 052ebc0c..f73f6aea 100644 --- a/command-signatures/src/generators/ffmpeg.rs +++ b/command-signatures/src/generators/ffmpeg.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("ffmpeg -codecs"), - fig_parse::second_whitespace_token, + output_parsers::second_whitespace_token, ), ) .add_generator( "completions_devices", Generator::script( CommandBuilder::single_command("ffmpeg -devices"), - fig_parse::second_whitespace_token, + output_parsers::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/fig_teams_latest.rs b/command-signatures/src/generators/fig_teams.rs similarity index 78% rename from command-signatures/src/generators/fig_teams_latest.rs rename to command-signatures/src/generators/fig_teams.rs index 9ea1f363..a2d18b0c 100644 --- a/command-signatures/src/generators/fig_teams_latest.rs +++ b/command-signatures/src/generators/fig_teams.rs @@ -1,18 +1,21 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("fig-teams@latest") .add_generator( - "npx_fig_teams_latest_teams", + "teams_list", Generator::script( CommandBuilder::single_command("npx -y fig-teams@latest teams ls --json"), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) .add_generator( - "npx_fig_teams_latest_users", - Generator::command_from_tokens(users_for_selected_team, fig_parse::json_string_array), + "users_for_selected_team", + Generator::command_from_tokens( + users_for_selected_team, + output_parsers::json_string_array, + ), ) } diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs new file mode 100644 index 00000000..c8179c4c --- /dev/null +++ b/command-signatures/src/generators/fig_token.rs @@ -0,0 +1,275 @@ +use warp_completion_metadata::CommandBuilder; + +pub fn npms_search(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + curl_npms(last_token(tokens), "") +} + +pub fn npms_search_create_prefix(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let q = last_token(tokens); + if q.is_empty() { + CommandBuilder::single_command("true") + } else { + curl_npms(&format!("create-{q}"), "") + } +} + +pub fn crates_io_search(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let q = last_token(tokens); + if q.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!( + "curl -sfL 'https://crates.io/api/v1/crates?q={}&per_page=60'", + urlencode(q) + )) + } +} + +pub fn trivy_severity_remaining(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + remaining_csv(tokens, &["UNKNOWN", "LOW", "MEDIUM", "HIGH", "CRITICAL"]) +} + +pub fn trivy_scanners_remaining(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + remaining_csv(tokens, &["vuln", "config"]) +} + +pub fn trivy_pkg_types_remaining(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + remaining_csv(tokens, &["os", "library"]) +} + +pub fn docker_from_as(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let file = dockerfile_from_tokens(tokens); + CommandBuilder::single_command(format!( + r#"grep -iE 'FROM.*AS' {} 2>/dev/null"#, + shell_single_quote(&file) + )) +} + +pub fn docker_search(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let q = last_token(tokens); + if q.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!( + "docker search {} --format '{{{{ json . }}}}'", + shell_single_quote(q) + )) + } +} + +pub fn gh_repo_list_for_owner(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let token = last_token(tokens); + let owner = token.split('/').next().unwrap_or(""); + if owner.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!( + "gh repo list {} --limit 9999 --json nameWithOwner,description", + shell_single_quote(owner) + )) + } +} + +pub fn apt_list_prefix(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let q = last_token(tokens); + if q.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!( + r#"apt list 2>/dev/null | awk -F/ -v p={} '$1 ~ "^"p {{ print $1 }}'"#, + shell_single_quote(®ex_escape(q)) + )) + } +} + +pub fn cargo_test_list(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let token = last_token(tokens); + let depth = token.split("::").filter(|s| !s.is_empty()).count().max(1); + let last = token.split("::").last().unwrap_or(""); + CommandBuilder::single_command(format!( + r#"cargo t -- --list 2>/dev/null | awk '/: test$/ {{ print substr($1, 1, length($1) - 1) }}' | awk -F '::' '{{ print ${depth} }}' | grep -F {query} | sort -u"#, + depth = depth, + query = shell_single_quote(last) + )) +} + +pub fn chown_dscl(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let has_colon = tokens.iter().any(|t| t.contains(':')); + if has_colon { + CommandBuilder::single_command( + "dscl . -list /Groups PrimaryGroupID 2>/dev/null | tr -s ' ' | sort -r", + ) + } else { + CommandBuilder::single_command( + "dscl . -list /Users UniqueID 2>/dev/null | tr -s ' ' | sort -r", + ) + } +} + +pub fn nx_list(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let last = last_token(tokens); + if last.contains(':') { + let project = last.split(':').next().unwrap_or(""); + CommandBuilder::single_command(format!("nx list {}", shell_single_quote(project))) + } else { + CommandBuilder::single_command("nx list") + } +} + +pub fn youtube_dl_flat_playlist(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let urls: Vec<_> = tokens + .iter() + .copied() + .filter(|t| t.contains("youtube.")) + .map(shell_single_quote) + .collect(); + if urls.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!("youtube-dl --flat-playlist -J {}", urls.join(" "))) + } +} + +pub fn deno_doc_json(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let keep = ["--private", "--builtin", "--unstable"]; + let mut args: Vec = tokens + .iter() + .copied() + .take(tokens.len().saturating_sub(1)) + .filter(|t| { + (!t.starts_with('-') || keep.contains(t)) && !t.starts_with('$') && !t.starts_with('(') + }) + .map(shell_single_quote) + .collect(); + args.push("--json".to_string()); + CommandBuilder::single_command(format!("deno doc {}", args.join(" "))) +} + +pub fn git_status_staged_or_unstaged(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + if tokens.contains(&"--staged") || tokens.contains(&"--cached") { + CommandBuilder::single_command( + "git --no-optional-locks status --short | sed -ne '/^M /p' -e '/A /p'", + ) + } else { + CommandBuilder::single_command( + "git --no-optional-locks status --short | sed -ne '/M /p' -e '/A /p'", + ) + } +} + +pub fn eslint_env_remaining(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + remaining_csv( + tokens, + &[ + "browser", + "node", + "commonjs", + "shared-node-browser", + "es6", + "es2017", + "es2020", + "es2021", + "worker", + "amd", + "mocha", + "jasmine", + "jest", + "phantomjs", + "protractor", + "qunit", + "jquery", + "prototypejs", + "shelljs", + "meteor", + "mongo", + "applescript", + "nashorn", + "serviceworker", + "atomtest", + "embertest", + "webextensions", + "greasemonkey", + ], + ) +} + +pub fn brew_gist_logs_actions(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let has_non_flag = tokens + .iter() + .skip(2) + .any(|t| !t.starts_with('-') && !t.is_empty()); + if has_non_flag { + remaining_csv(tokens, &["install", "install-on-request", "build-error"]) + } else { + remaining_csv(tokens, &["cask-install", "os-version"]) + } +} + +fn curl_npms(query: &str, _: &str) -> CommandBuilder { + if query.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!( + "curl -s -H 'Accept: application/json' 'https://api.npms.io/v2/search?size=20&q={}'", + urlencode(query) + )) + } +} + +fn remaining_csv(tokens: &[&str], options: &[&str]) -> CommandBuilder { + let used: std::collections::HashSet<&str> = last_token(tokens) + .split(',') + .filter(|s| !s.is_empty()) + .collect(); + let left: Vec<&str> = options + .iter() + .copied() + .filter(|o| !used.contains(o)) + .collect(); + if left.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!("printf '%s\\n' {}", left.join(" "))) + } +} + +fn dockerfile_from_tokens(tokens: &[&str]) -> String { + if let Some(i) = tokens.iter().position(|t| *t == "-f" || *t == "--file") { + if i + 1 < tokens.len() { + return tokens[i + 1].to_string(); + } + } + "$PWD/Dockerfile".to_string() +} + +fn last_token<'a>(tokens: &[&'a str]) -> &'a str { + tokens.last().copied().unwrap_or("") +} + +fn shell_single_quote(value: &str) -> String { + format!("'{}'", value.replace('\'', r"'\''")) +} + +fn regex_escape(value: &str) -> String { + let mut out = String::new(); + for c in value.chars() { + if "^$.*+?()[]{}|\\".contains(c) { + out.push('\\'); + } + out.push(c); + } + out +} + +fn urlencode(value: &str) -> String { + let mut out = String::new(); + for b in value.as_bytes() { + match b { + b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => { + out.push(*b as char); + } + _ => out.push_str(&format!("%{b:02X}")), + } + } + out +} diff --git a/command-signatures/src/generators/fisher.rs b/command-signatures/src/generators/fisher.rs index d2613619..d19b9b2a 100644 --- a/command-signatures/src/generators/fisher.rs +++ b/command-signatures/src/generators/fisher.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "fish_fisher_list", Generator::script( CommandBuilder::single_command("fish -c 'fisher list'"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/fly.rs b/command-signatures/src/generators/fly.rs index 64588ede..814074e0 100644 --- a/command-signatures/src/generators/fly.rs +++ b/command-signatures/src/generators/fly.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "flyctl_list_apps", Generator::script( CommandBuilder::single_command("flyctl list apps"), - fig_parse::pipe_table_name_col1_desc, + output_parsers::pipe_table_name_col1_desc, ), ) .add_generator( "flyctl_list_orgs", Generator::script( CommandBuilder::single_command("flyctl list orgs"), - fig_parse::pipe_table_name_col1_desc, + output_parsers::pipe_table_name_col1_desc, ), ) } diff --git a/command-signatures/src/generators/flyctl.rs b/command-signatures/src/generators/flyctl.rs index 86449c47..9791686f 100644 --- a/command-signatures/src/generators/flyctl.rs +++ b/command-signatures/src/generators/flyctl.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "list_apps", Generator::script( CommandBuilder::single_command("flyctl list apps"), - fig_parse::pipe_table_name_col1_desc, + output_parsers::pipe_table_name_col1_desc, ), ) .add_generator( "list_orgs", Generator::script( CommandBuilder::single_command("flyctl list orgs"), - fig_parse::pipe_table_name_col1_desc, + output_parsers::pipe_table_name_col1_desc, ), ) } diff --git a/command-signatures/src/generators/fnm.rs b/command-signatures/src/generators/fnm.rs index b3a52ba5..261d8ad4 100644 --- a/command-signatures/src/generators/fnm.rs +++ b/command-signatures/src/generators/fnm.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "ls", Generator::script( CommandBuilder::single_command("fnm ls"), - fig_parse::slice2_reversed, + output_parsers::slice2_reversed, ), ) .add_generator( "ls_remote", Generator::script( CommandBuilder::single_command("fnm ls-remote"), - fig_parse::second_whitespace_token, + output_parsers::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/fvm.rs b/command-signatures/src/generators/fvm.rs index 4d00c0b9..742e9c32 100644 --- a/command-signatures/src/generators/fvm.rs +++ b/command-signatures/src/generators/fvm.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "releases", Generator::script( CommandBuilder::single_command("fvm releases"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/gh.rs b/command-signatures/src/generators/gh.rs index 1973db85..57ed3a43 100644 --- a/command-signatures/src/generators/gh.rs +++ b/command-signatures/src/generators/gh.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::{fig_token, output_parsers}; use lazy_static::lazy_static; use regex::Regex; use warp_completion_metadata::{ @@ -50,16 +50,20 @@ pub fn generator() -> CommandSignatureGenerators { "api_graphql_string_viewer", Generator::script( CommandBuilder::single_command("gh api graphql --paginate -f query='query($endCursor: String) { viewer { repositories(first: 100, after: $endCursor) { nodes { isPrivate, nameWithOwner, description } pageInfo { hasNextPage endCursor }}}}' --jq '.data.viewer.repositories.nodes[]'"), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) .add_generator( "git_branch", Generator::script( CommandBuilder::single_command("git --no-optional-locks branch -r --no-color --sort=-committerdate"), - fig_parse::lines, + output_parsers::lines, ), ) + .add_generator( + "repo_list_owner", + Generator::command_from_tokens(fig_token::gh_repo_list_for_owner, output_parsers::gh_repo_list_json), + ) } lazy_static! { diff --git a/command-signatures/src/generators/git.rs b/command-signatures/src/generators/git.rs index 7eae0a32..869fb640 100644 --- a/command-signatures/src/generators/git.rs +++ b/command-signatures/src/generators/git.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use itertools::Itertools; use warp_completion_metadata::{ Alias, CommandBuilder, CommandSignatureGenerators, Generator, GeneratorName, GeneratorResults, @@ -1033,35 +1033,42 @@ pub fn generator() -> CommandSignatureGenerators { "branches", Generator::script( CommandBuilder::single_command("git --no-optional-locks branch --no-color --sort=-committerdate"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "branches_no", Generator::script( CommandBuilder::single_command("git --no-optional-locks branch -a --no-color --sort=-committerdate"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "log", Generator::script( CommandBuilder::single_command("git --no-optional-locks log --oneline"), - fig_parse::git_oneline, + output_parsers::git_oneline, ), ) .add_generator( "status", Generator::script( CommandBuilder::single_command("git --no-optional-locks status --short"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "tag", Generator::script( CommandBuilder::single_command("git --no-optional-locks tag --list --sort=-committerdate"), - fig_parse::lines, + output_parsers::lines, + ), + ) + .add_generator( + "status_staged_or_unstaged", + Generator::command_from_tokens( + super::fig_token::git_status_staged_or_unstaged, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/gpg.rs b/command-signatures/src/generators/gpg.rs index ef977e50..ed1fc942 100644 --- a/command-signatures/src/generators/gpg.rs +++ b/command-signatures/src/generators/gpg.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("gpg --version"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/hexo.rs b/command-signatures/src/generators/hexo.rs index 108c5fea..6a88acfe 100644 --- a/command-signatures/src/generators/hexo.rs +++ b/command-signatures/src/generators/hexo.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list_post_draft", Generator::script( CommandBuilder::single_command("hexo list post | grep -E ^Draft"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/hugo.rs b/command-signatures/src/generators/hugo.rs index 0660addd..f70a1b54 100644 --- a/command-signatures/src/generators/hugo.rs +++ b/command-signatures/src/generators/hugo.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "ls_archetypes", Generator::script( CommandBuilder::single_command("ls ./archetypes/"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/hyper.rs b/command-signatures/src/generators/hyper.rs index c97bf0d9..6edd4517 100644 --- a/command-signatures/src/generators/hyper.rs +++ b/command-signatures/src/generators/hyper.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("hyper list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/id.rs b/command-signatures/src/generators/id.rs index 0c709170..f482c380 100644 --- a/command-signatures/src/generators/id.rs +++ b/command-signatures/src/generators/id.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "dscl_users", Generator::script( CommandBuilder::single_command("dscl . -list /Users | grep -v '^_'"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/ignite_cli.rs b/command-signatures/src/generators/ignite_cli.rs index 2137dcca..2559890c 100644 --- a/command-signatures/src/generators/ignite_cli.rs +++ b/command-signatures/src/generators/ignite_cli.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "ls_ignite_templates", Generator::script( CommandBuilder::single_command("ls ignite/templates"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/kool.rs b/command-signatures/src/generators/kool.rs index 764d4e7f..b1281616 100644 --- a/command-signatures/src/generators/kool.rs +++ b/command-signatures/src/generators/kool.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "docker_compose_config", Generator::script( CommandBuilder::single_command("docker-compose config --services"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "run", Generator::script( CommandBuilder::single_command("kool run --help"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/lerna.rs b/command-signatures/src/generators/lerna.rs index 4554c81a..c8a18245 100644 --- a/command-signatures/src/generators/lerna.rs +++ b/command-signatures/src/generators/lerna.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "git_branch", Generator::script( CommandBuilder::single_command("git branch --no-color"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "git_remote", Generator::script( CommandBuilder::single_command("git remote"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -23,11 +23,14 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( r"lerna list -p | while read p; do \cat $p/package.json && echo END done", ), - fig_parse::json_script_keys, + output_parsers::json_script_keys, ), ) .add_generator( "ls", - Generator::script(CommandBuilder::single_command("lerna ls"), fig_parse::lines), + Generator::script( + CommandBuilder::single_command("lerna ls"), + output_parsers::lines, + ), ) } diff --git a/command-signatures/src/generators/limactl.rs b/command-signatures/src/generators/limactl.rs index 2432c3d4..b4ed4016 100644 --- a/command-signatures/src/generators/limactl.rs +++ b/command-signatures/src/generators/limactl.rs @@ -1,4 +1,4 @@ -use super::{fig_filters, fig_parse}; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,8 +7,8 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("limactl list --quiet"), - fig_parse::lines_desc_instance, + output_parsers::lines_desc_instance, ), ) - .add_filter("filter-yml-yaml", fig_filters::yml_yaml()) + .add_filter("filter-yml-yaml", template_filters::yml_yaml()) } diff --git a/command-signatures/src/generators/mackup.rs b/command-signatures/src/generators/mackup.rs index 62c5bfed..c4e761ae 100644 --- a/command-signatures/src/generators/mackup.rs +++ b/command-signatures/src/generators/mackup.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("mackup list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/mdfind.rs b/command-signatures/src/generators/mdfind.rs index 6244ea45..d85e3513 100644 --- a/command-signatures/src/generators/mdfind.rs +++ b/command-signatures/src/generators/mdfind.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "ls_library_saved_searches_savedsearch", Generator::script( CommandBuilder::single_command(r"ls -1A ~/Library/Saved\ Searches/*.savedSearch"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/meteor.rs b/command-signatures/src/generators/meteor.rs index 5368b124..5eeb8365 100644 --- a/command-signatures/src/generators/meteor.rs +++ b/command-signatures/src/generators/meteor.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,21 +7,21 @@ pub fn generator() -> CommandSignatureGenerators { "cat_meteor_packages", Generator::script( CommandBuilder::single_command("cat ./.meteor/packages"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "create", Generator::script( CommandBuilder::single_command("meteor create --list"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "list_platforms", Generator::script( CommandBuilder::single_command("meteor list-platforms"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/mix.rs b/command-signatures/src/generators/mix.rs index 7f441cee..50ef63e1 100644 --- a/command-signatures/src/generators/mix.rs +++ b/command-signatures/src/generators/mix.rs @@ -1,9 +1,12 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("mix").add_generator( "help", - Generator::script(CommandBuilder::single_command("mix help"), fig_parse::lines), + Generator::script( + CommandBuilder::single_command("mix help"), + output_parsers::lines, + ), ) } diff --git a/command-signatures/src/generators/mod.rs b/command-signatures/src/generators/mod.rs index 7410d715..bf2f54a5 100644 --- a/command-signatures/src/generators/mod.rs +++ b/command-signatures/src/generators/mod.rs @@ -10,6 +10,7 @@ mod autojump; mod bat; mod black; mod checkov; +mod chown; mod cmd_n; mod common; mod copilot; @@ -26,9 +27,8 @@ mod eslint; mod expo; mod expo_cli; mod ffmpeg; -mod fig_filters; -mod fig_parse; -mod fig_teams_latest; +mod fig_teams; +mod fig_token; mod fisher; mod fly; mod flyctl; @@ -55,6 +55,7 @@ mod ns; mod okteto; mod op; mod open; +mod output_parsers; mod pandoc; mod pre_commit; mod projj; @@ -76,11 +77,13 @@ mod stepzen; mod sysctl; mod tailscale; mod tccutil; +mod template_filters; mod terragrunt; mod tfenv; mod tfsec; mod tokei; mod trex; +mod trivy; mod ts_node; mod turbo; mod vite; @@ -272,6 +275,7 @@ pub fn dynamic_command_signature_data() -> HashMap HashMap HashMap CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "cat_ssh_config", Generator::script( CommandBuilder::single_command("cat ~/.ssh/config"), - fig_parse::ssh_hosts, + output_parsers::ssh_hosts, ), ) .add_generator( "cat_ssh_known_hosts", Generator::script( CommandBuilder::single_command("cat ~/.ssh/known_hosts"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/networkquality.rs b/command-signatures/src/generators/networkquality.rs index 52818c1e..ff2e9bab 100644 --- a/command-signatures/src/generators/networkquality.rs +++ b/command-signatures/src/generators/networkquality.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "networksetup", Generator::script( CommandBuilder::single_command("networksetup -listallhardwareports"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/npm.rs b/command-signatures/src/generators/npm.rs index 88ed1ace..27670526 100644 --- a/command-signatures/src/generators/npm.rs +++ b/command-signatures/src/generators/npm.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{ Alias, CommandBuilder, CommandSignatureGenerators, Generator, GeneratorResults, GeneratorResultsCollector, Suggestion, @@ -327,7 +327,7 @@ pub fn pnpm_generators() -> CommandSignatureGenerators { "until_package_json_do_cd", Generator::script( CommandBuilder::single_command("until [[ -f package.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat package.json"), - fig_parse::json_script_keys, + output_parsers::json_script_keys, ), ) } @@ -382,6 +382,13 @@ pub fn yarn_generators() -> CommandSignatureGenerators { executables_within_node_modules(), ) .add_alias("script_alias", script_alias_generator()) + .add_generator( + "create_package_search", + Generator::command_from_tokens( + super::fig_token::npms_search_create_prefix, + super::output_parsers::npms_search_results, + ), + ) } #[cfg(test)] diff --git a/command-signatures/src/generators/npx.rs b/command-signatures/src/generators/npx.rs index ab1d6742..0cd764ee 100644 --- a/command-signatures/src/generators/npx.rs +++ b/command-signatures/src/generators/npx.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "until_node_modules_do_cd", Generator::script( CommandBuilder::single_command("until [[ -d node_modules/ ]] || [[ $PWD = '/' ]]; do cd ..; done; ls -1 node_modules/.bin/"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/nr.rs b/command-signatures/src/generators/nr.rs index a7ee1c17..86dcffda 100644 --- a/command-signatures/src/generators/nr.rs +++ b/command-signatures/src/generators/nr.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f package.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat package.json", ), - fig_parse::json_script_keys, + output_parsers::json_script_keys, ), ) } diff --git a/command-signatures/src/generators/ns.rs b/command-signatures/src/generators/ns.rs index 1fe07d95..c7ab54dc 100644 --- a/command-signatures/src/generators/ns.rs +++ b/command-signatures/src/generators/ns.rs @@ -1,13 +1,13 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("ns") .add_generator( - "curl_https_api_github_com_repos_nativescript_nativescript_app_templates_contents_packages", + "nativescript_templates", Generator::script( CommandBuilder::single_command("curl https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages"), - fig_parse::json_nativescript_templates, + output_parsers::json_nativescript_templates, ), ) } diff --git a/command-signatures/src/generators/nx.rs b/command-signatures/src/generators/nx.rs index 22a976b1..86944673 100644 --- a/command-signatures/src/generators/nx.rs +++ b/command-signatures/src/generators/nx.rs @@ -151,6 +151,10 @@ pub fn generator() -> CommandSignatureGenerators { } }), ) + .add_generator( + "plugin_list", + Generator::command_from_tokens(super::fig_token::nx_list, super::output_parsers::lines), + ) } #[cfg(test)] diff --git a/command-signatures/src/generators/okteto.rs b/command-signatures/src/generators/okteto.rs index 4cfb733d..a0a3caa7 100644 --- a/command-signatures/src/generators/okteto.rs +++ b/command-signatures/src/generators/okteto.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "context_list", Generator::script( CommandBuilder::single_command("okteto context list"), - fig_parse::lines_desc_context, + output_parsers::lines_desc_context, ), ) .add_generator( "namespace_list", Generator::script( CommandBuilder::single_command("okteto namespace list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/op.rs b/command-signatures/src/generators/op.rs index c13c57bf..5313561a 100644 --- a/command-signatures/src/generators/op.rs +++ b/command-signatures/src/generators/op.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "account_list_json", Generator::script( CommandBuilder::single_command("op account list --format json"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/open.rs b/command-signatures/src/generators/open.rs index 14c2bd46..af24786d 100644 --- a/command-signatures/src/generators/open.rs +++ b/command-signatures/src/generators/open.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "mdfind", Generator::script( CommandBuilder::single_command("mdfind kMDItemContentTypeTree=com.apple.application-bundle -onlyin /"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "mdfind_while_read_line", Generator::script( CommandBuilder::single_command(r#"mdfind kMDItemContentTypeTree=com.apple.application-bundle -onlyin / | while read line; do echo $(mdls -name kMDItemCFBundleIdentifier -r "$line") $line; done"#), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/fig_parse.rs b/command-signatures/src/generators/output_parsers.rs similarity index 78% rename from command-signatures/src/generators/fig_parse.rs rename to command-signatures/src/generators/output_parsers.rs index f18d9505..e210f3b5 100644 --- a/command-signatures/src/generators/fig_parse.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -223,6 +223,77 @@ pub fn json_script_keys(output: &str) -> GeneratorResults { } } +pub fn npms_search_results(output: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("results").cloned()) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let package = value.get("package")?; + let name = package.get("name")?.as_str()?; + let description = package + .get("description") + .and_then(Value::as_str) + .unwrap_or(""); + Some(Suggestion::with_description(name, description)) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn json_crates(output: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("crates").cloned()) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let name = value.get("name")?.as_str()?; + let description = value + .get("description") + .and_then(Value::as_str) + .map(str::to_owned) + .or_else(|| { + value + .get("newest_version") + .and_then(Value::as_str) + .map(|version| format!("v{version}")) + }) + .unwrap_or_default(); + Some(Suggestion::with_description(name, description)) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn gh_repo_list_json(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let name = value.get("nameWithOwner")?.as_str()?; + let description = value + .get("description") + .and_then(Value::as_str) + .unwrap_or(""); + Some(Suggestion::with_description(name, description)) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn docker_from_as_names(output: &str) -> GeneratorResults { + let re = regex::Regex::new(r"(?i)(?:as)\s+([\w:.-]+)").ok(); + nonempty_lines(output) + .filter_map(|line| { + re.as_ref() + .and_then(|re| re.captures(line)) + .and_then(|c| c.get(1)) + .map(|m| Suggestion::new(m.as_str())) + }) + .collect_unordered_results() +} + pub fn ssh_hosts(output: &str) -> GeneratorResults { nonempty_lines(output) .filter(|line| line.trim().starts_with("Host ") && !line.contains('*')) diff --git a/command-signatures/src/generators/pandoc.rs b/command-signatures/src/generators/pandoc.rs index 22f0d094..068e15b0 100644 --- a/command-signatures/src/generators/pandoc.rs +++ b/command-signatures/src/generators/pandoc.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("pandoc --list-output-formats"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "completions_list", Generator::script( CommandBuilder::single_command("pandoc --list-input-formats"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -23,7 +23,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "pandoc --list-input-formats && pandoc --list-output-formats", ), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/pre_commit.rs b/command-signatures/src/generators/pre_commit.rs index e4189517..e442aa72 100644 --- a/command-signatures/src/generators/pre_commit.rs +++ b/command-signatures/src/generators/pre_commit.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_pre_commit_config_yaml", Generator::script( CommandBuilder::single_command("cat .pre-commit-config.yaml"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -16,7 +16,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch --no-color --sort=-committerdate", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -25,21 +25,21 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch -a --no-color --sort=-committerdate", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "git_remote", Generator::script( CommandBuilder::single_command("git --no-optional-locks remote -v"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "git_rev_list", Generator::script( CommandBuilder::single_command("git rev-list --all --oneline"), - fig_parse::git_oneline, + output_parsers::git_oneline, ), ) } diff --git a/command-signatures/src/generators/projj.rs b/command-signatures/src/generators/projj.rs index 1bba51fc..f0dc6737 100644 --- a/command-signatures/src/generators/projj.rs +++ b/command-signatures/src/generators/projj.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "cat_projj_cache_json", Generator::script( CommandBuilder::single_command("cat ~/.projj/cache.json"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "cat_projj_config_json", Generator::script( CommandBuilder::single_command("cat ~/.projj/config.json"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/python.rs b/command-signatures/src/generators/python.rs index 39b761d1..0b3c59ec 100644 --- a/command-signatures/src/generators/python.rs +++ b/command-signatures/src/generators/python.rs @@ -1,10 +1,10 @@ -use super::fig_filters; +use super::template_filters; use warp_completion_metadata::CommandSignatureGenerators; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("python").add_filter("filter-py", fig_filters::py()) + CommandSignatureGenerators::new("python").add_filter("filter-py", template_filters::py()) } pub fn python3_generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("python3").add_filter("filter-py", fig_filters::py()) + CommandSignatureGenerators::new("python3").add_filter("filter-py", template_filters::py()) } diff --git a/command-signatures/src/generators/quickmail.rs b/command-signatures/src/generators/quickmail.rs index ce226499..af4a4d03 100644 --- a/command-signatures/src/generators/quickmail.rs +++ b/command-signatures/src/generators/quickmail.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "template_listall", Generator::script( CommandBuilder::single_command("quickmail template listall"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/r.rs b/command-signatures/src/generators/r.rs index 43df12a6..fefcdafc 100644 --- a/command-signatures/src/generators/r.rs +++ b/command-signatures/src/generators/r.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "rscript_libpaths", Generator::script( CommandBuilder::single_command("Rscript -e '.libPaths()'"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/rancher.rs b/command-signatures/src/generators/rancher.rs index 94811388..c7486444 100644 --- a/command-signatures/src/generators/rancher.rs +++ b/command-signatures/src/generators/rancher.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "server", Generator::script( CommandBuilder::single_command("rancher server ls"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/rclone.rs b/command-signatures/src/generators/rclone.rs index 17ead206..c0c6eb1e 100644 --- a/command-signatures/src/generators/rclone.rs +++ b/command-signatures/src/generators/rclone.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "listremotes", Generator::script( CommandBuilder::single_command("rclone listremotes"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/redwood.rs b/command-signatures/src/generators/redwood.rs index 78a65b31..fbbda8ea 100644 --- a/command-signatures/src/generators/redwood.rs +++ b/command-signatures/src/generators/redwood.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f redwood.toml ]] || [[ $PWD = '/' ]]; do cd ..; done; ls -1p scripts/", ), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/robot.rs b/command-signatures/src/generators/robot.rs index bc0c719d..62a3889d 100644 --- a/command-signatures/src/generators/robot.rs +++ b/command-signatures/src/generators/robot.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( r#"for i in $(find -E . -regex ".*.robot" -type f); do cat -s $i ; done"#, ), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/rush.rs b/command-signatures/src/generators/rush.rs index 3b20c08e..1e9cb018 100644 --- a/command-signatures/src/generators/rush.rs +++ b/command-signatures/src/generators/rush.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f rush.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat rush.json", ), - fig_parse::json_rush_projects, + output_parsers::json_rush_projects, ), ) } diff --git a/command-signatures/src/generators/rushx.rs b/command-signatures/src/generators/rushx.rs index 2dcf31da..5941bf0e 100644 --- a/command-signatures/src/generators/rushx.rs +++ b/command-signatures/src/generators/rushx.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f package.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat package.json", ), - fig_parse::json_script_keys, + output_parsers::json_script_keys, ), ) } diff --git a/command-signatures/src/generators/rustup.rs b/command-signatures/src/generators/rustup.rs index 66ebb6e1..ebfa6f46 100644 --- a/command-signatures/src/generators/rustup.rs +++ b/command-signatures/src/generators/rustup.rs @@ -1,13 +1,13 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("rustup") .add_generator( - "find_docs_s_index_html", + "rustup_docs", Generator::script( CommandBuilder::single_command(r#"find $(rustup docs --path | sed -e "s|index\.html|std|") $(rustup docs --path | sed -e "s|index\.html|alloc|") $(rustup docs --path | sed -e "s|index\.html|core|") | grep "\.html" | sed -E -e "s|^(.*)/html/||" -e "s|\.html||" -e "s|/|::|g" -e "s/constant\.|trait\.|struct\.|macro\.|fn\.|keyword\.|primitive\.|type\.|enum\.|union\.|traitalias\.|::index$|^(.*)::all$//" -e "/^$/d""#), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/scc.rs b/command-signatures/src/generators/scc.rs index 3b6e2c63..f520813d 100644 --- a/command-signatures/src/generators/scc.rs +++ b/command-signatures/src/generators/scc.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("scc --languages"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/sftp.rs b/command-signatures/src/generators/sftp.rs index fef6808d..f8d95312 100644 --- a/command-signatures/src/generators/sftp.rs +++ b/command-signatures/src/generators/sftp.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "cat_ssh_config", Generator::script( CommandBuilder::single_command("cat ~/.ssh/config"), - fig_parse::ssh_hosts, + output_parsers::ssh_hosts, ), ) .add_generator( "cat_ssh_known_hosts", Generator::script( CommandBuilder::single_command("cat ~/.ssh/known_hosts"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/shortcuts.rs b/command-signatures/src/generators/shortcuts.rs index 38e88e02..2de9e842 100644 --- a/command-signatures/src/generators/shortcuts.rs +++ b/command-signatures/src/generators/shortcuts.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("shortcuts list"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "list_shortcuts", Generator::script( CommandBuilder::single_command("shortcuts list --folders"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/softwareupdate.rs b/command-signatures/src/generators/softwareupdate.rs index 5d34c12e..06b583c2 100644 --- a/command-signatures/src/generators/softwareupdate.rs +++ b/command-signatures/src/generators/softwareupdate.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("softwareupdate --list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/stepzen.rs b/command-signatures/src/generators/stepzen.rs index 3c5ece01..9781de36 100644 --- a/command-signatures/src/generators/stepzen.rs +++ b/command-signatures/src/generators/stepzen.rs @@ -1,22 +1,22 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("stepzen") .add_generator( - "curl_https_api_github_com_repos_steprz_stepzen_schemas_contents", + "github_schemas", Generator::script( CommandBuilder::single_command( "curl https://api.github.com/repos/steprz/stepzen-schemas/contents", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "list_schemas", Generator::script( CommandBuilder::single_command("stepzen list schemas"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/sysctl.rs b/command-signatures/src/generators/sysctl.rs index eb21dba9..062af9cc 100644 --- a/command-signatures/src/generators/sysctl.rs +++ b/command-signatures/src/generators/sysctl.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("sysctl -A -N"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/tailscale.rs b/command-signatures/src/generators/tailscale.rs index 7127e2dd..28f0e065 100644 --- a/command-signatures/src/generators/tailscale.rs +++ b/command-signatures/src/generators/tailscale.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "status", Generator::script( CommandBuilder::single_command("tailscale status --json"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/tccutil.rs b/command-signatures/src/generators/tccutil.rs index 8da14b42..e31776ba 100644 --- a/command-signatures/src/generators/tccutil.rs +++ b/command-signatures/src/generators/tccutil.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "mdfind_applications_while_read", Generator::script( CommandBuilder::single_command(r#"mdfind kMDItemContentTypeTree=com.apple.application-bundle -onlyin /Applications | while read line; do echo $(mdls -name kMDItemCFBundleIdentifier -r "$line") $line; done"#), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/fig_filters.rs b/command-signatures/src/generators/template_filters.rs similarity index 100% rename from command-signatures/src/generators/fig_filters.rs rename to command-signatures/src/generators/template_filters.rs diff --git a/command-signatures/src/generators/terragrunt.rs b/command-signatures/src/generators/terragrunt.rs index 51870dc1..e5fcdfc5 100644 --- a/command-signatures/src/generators/terragrunt.rs +++ b/command-signatures/src/generators/terragrunt.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "state_list", Generator::script( CommandBuilder::single_command("terragrunt state list"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "workspace_list", Generator::script( CommandBuilder::single_command("terragrunt workspace list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/tfenv.rs b/command-signatures/src/generators/tfenv.rs index 5ee63f98..1d10d89f 100644 --- a/command-signatures/src/generators/tfenv.rs +++ b/command-signatures/src/generators/tfenv.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("tfenv list"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "list_remote", Generator::script( CommandBuilder::single_command("tfenv list-remote"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/tfsec.rs b/command-signatures/src/generators/tfsec.rs index 0881beb1..8c28c757 100644 --- a/command-signatures/src/generators/tfsec.rs +++ b/command-signatures/src/generators/tfsec.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "terraform_workspace_list", Generator::script( CommandBuilder::single_command("terraform workspace list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/tokei.rs b/command-signatures/src/generators/tokei.rs index 62deed07..9fa960b7 100644 --- a/command-signatures/src/generators/tokei.rs +++ b/command-signatures/src/generators/tokei.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("tokei --languages"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/trex.rs b/command-signatures/src/generators/trex.rs index 5a2d7762..9ad33651 100644 --- a/command-signatures/src/generators/trex.rs +++ b/command-signatures/src/generators/trex.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "cat_import_map_json", Generator::script( CommandBuilder::single_command("cat import_map.json"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "cat_run_json", Generator::script( CommandBuilder::single_command("cat run.json"), - fig_parse::json_script_keys, + output_parsers::json_script_keys, ), ) } diff --git a/command-signatures/src/generators/trivy.rs b/command-signatures/src/generators/trivy.rs new file mode 100644 index 00000000..047c9354 --- /dev/null +++ b/command-signatures/src/generators/trivy.rs @@ -0,0 +1,27 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("trivy") + .add_generator( + "severity_remaining", + Generator::command_from_tokens( + fig_token::trivy_severity_remaining, + output_parsers::lines, + ), + ) + .add_generator( + "scanners_remaining", + Generator::command_from_tokens( + fig_token::trivy_scanners_remaining, + output_parsers::lines, + ), + ) + .add_generator( + "pkg_types_remaining", + Generator::command_from_tokens( + fig_token::trivy_pkg_types_remaining, + output_parsers::lines, + ), + ) +} diff --git a/command-signatures/src/generators/ts_node.rs b/command-signatures/src/generators/ts_node.rs index 561adffa..f4aaa597 100644 --- a/command-signatures/src/generators/ts_node.rs +++ b/command-signatures/src/generators/ts_node.rs @@ -1,7 +1,7 @@ -use super::fig_filters; +use super::template_filters; use warp_completion_metadata::CommandSignatureGenerators; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("ts-node") - .add_filter("filter-tsconfig", fig_filters::tsconfig_json()) + .add_filter("filter-tsconfig", template_filters::tsconfig_json()) } diff --git a/command-signatures/src/generators/turbo.rs b/command-signatures/src/generators/turbo.rs index f19e85ca..20466fd8 100644 --- a/command-signatures/src/generators/turbo.rs +++ b/command-signatures/src/generators/turbo.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -9,7 +9,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch -a --no-color --sort=-committerdate", ), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( @@ -18,7 +18,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ ( -f turbo.json || $PWD = '/' ) ]]; do cd ..; done; cat turbo.json", ), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/vite.rs b/command-signatures/src/generators/vite.rs index 15681a22..f797ee15 100644 --- a/command-signatures/src/generators/vite.rs +++ b/command-signatures/src/generators/vite.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "ls", Generator::script( CommandBuilder::single_command(r"\ls -l1A.env.*"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/vr.rs b/command-signatures/src/generators/vr.rs index 18e7ffbf..33fc5dcb 100644 --- a/command-signatures/src/generators/vr.rs +++ b/command-signatures/src/generators/vr.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("NO_COLOR=1 vr"), - fig_parse::second_whitespace_token, + output_parsers::second_whitespace_token, ), ) } diff --git a/command-signatures/src/generators/vsce.rs b/command-signatures/src/generators/vsce.rs index bffaba81..5a589ad6 100644 --- a/command-signatures/src/generators/vsce.rs +++ b/command-signatures/src/generators/vsce.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch -a --no-color --sort=-committerdate", ), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/vultr_cli.rs b/command-signatures/src/generators/vultr_cli.rs index 252d14e6..62f840e3 100644 --- a/command-signatures/src/generators/vultr_cli.rs +++ b/command-signatures/src/generators/vultr_cli.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "instance_list", Generator::script( CommandBuilder::single_command("vultr-cli instance list"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/watson.rs b/command-signatures/src/generators/watson.rs index ade3a72c..99c14637 100644 --- a/command-signatures/src/generators/watson.rs +++ b/command-signatures/src/generators/watson.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,21 +7,21 @@ pub fn generator() -> CommandSignatureGenerators { "log", Generator::script( CommandBuilder::single_command("watson log --json --reverse"), - fig_parse::json_string_array, + output_parsers::json_string_array, ), ) .add_generator( "projects", Generator::script( CommandBuilder::single_command("watson projects"), - fig_parse::lines, + output_parsers::lines, ), ) .add_generator( "tags", Generator::script( CommandBuilder::single_command("watson tags"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/wd.rs b/command-signatures/src/generators/wd.rs index 03eff225..53c83ba1 100644 --- a/command-signatures/src/generators/wd.rs +++ b/command-signatures/src/generators/wd.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_warprc", Generator::script( CommandBuilder::single_command("cat ~/.warprc"), - fig_parse::lines_desc_warp_point, + output_parsers::lines_desc_warp_point, ), ) } diff --git a/command-signatures/src/generators/wifi_password.rs b/command-signatures/src/generators/wifi_password.rs index e08dff1a..0ba6e45f 100644 --- a/command-signatures/src/generators/wifi_password.rs +++ b/command-signatures/src/generators/wifi_password.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "networksetup_wi_fi_getline_print_networksetup", Generator::script( CommandBuilder::single_command("networksetup -listallhardwareports | awk '/Wi-Fi/{getline; print $2}' | xargs networksetup -listpreferredwirelessnetworks"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/yo.rs b/command-signatures/src/generators/yo.rs index 527e1e1d..05f81484 100644 --- a/command-signatures/src/generators/yo.rs +++ b/command-signatures/src/generators/yo.rs @@ -1,4 +1,4 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("yo --generators"), - fig_parse::lines, + output_parsers::lines, ), ) } diff --git a/command-signatures/src/generators/youtube_dl.rs b/command-signatures/src/generators/youtube_dl.rs index fcf7d9fa..6a46fdce 100644 --- a/command-signatures/src/generators/youtube_dl.rs +++ b/command-signatures/src/generators/youtube_dl.rs @@ -1,9 +1,20 @@ -use super::fig_parse; +use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("youtube-dl").add_generator( - "pbpaste", - Generator::script(CommandBuilder::single_command("pbpaste"), fig_parse::lines), - ) + CommandSignatureGenerators::new("youtube-dl") + .add_generator( + "pbpaste", + Generator::script( + CommandBuilder::single_command("pbpaste"), + output_parsers::lines, + ), + ) + .add_generator( + "flat_playlist", + Generator::command_from_tokens( + super::fig_token::youtube_dl_flat_playlist, + output_parsers::lines, + ), + ) } From 34e7ed4672edf1ea2c11990af5d8ba2397318e9c Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 19:09:59 +0000 Subject: [PATCH 04/20] Port remaining Fig custom generators and template filters Wire token-aware custom generators (degit, git-flow, dd, man, file, esbuild, robot, scc) and recover filepaths({extensions}) filters from withfig sources onto JSON filterTemplateName. --- command-signatures/json/apt.json | 165 +++++++--- command-signatures/json/brew.json | 6 +- command-signatures/json/bun.json | 3 +- command-signatures/json/cargo.json | 111 ++++--- command-signatures/json/chown.json | 3 +- command-signatures/json/cloudflared.json | 24 +- command-signatures/json/dd.json | 2 +- command-signatures/json/degit.json | 2 +- command-signatures/json/deployctl.json | 3 +- command-signatures/json/direnv.json | 3 +- command-signatures/json/docker.json | 15 +- command-signatures/json/dtm.json | 15 +- command-signatures/json/elixir.json | 3 +- command-signatures/json/esbuild.json | 17 +- command-signatures/json/eslint.json | 3 +- command-signatures/json/expo-cli.json | 3 +- command-signatures/json/expo.json | 3 +- command-signatures/json/file.json | 2 +- command-signatures/json/gh.json | 15 +- command-signatures/json/git-flow.json | 6 +- command-signatures/json/hub.json | 6 +- command-signatures/json/iex.json | 3 +- command-signatures/json/java.json | 6 +- command-signatures/json/julia.json | 9 +- command-signatures/json/limactl.json | 3 +- command-signatures/json/man.json | 2 +- command-signatures/json/meteor.json | 15 +- command-signatures/json/mix.json | 9 +- command-signatures/json/n.json | 3 +- command-signatures/json/ni.json | 3 +- command-signatures/json/npm.json | 9 +- command-signatures/json/nx.json | 3 +- command-signatures/json/osascript.json | 3 +- command-signatures/json/pandoc.json | 6 +- command-signatures/json/pdfunite.json | 3 +- command-signatures/json/pm2.json | 9 +- command-signatures/json/pnpm.json | 8 +- command-signatures/json/pod.json | 15 +- command-signatures/json/r.json | 21 +- command-signatures/json/rancher.json | 3 +- command-signatures/json/robot.json | 31 +- command-signatures/json/rollup.json | 3 +- command-signatures/json/rscript.json | 3 +- command-signatures/json/rush.json | 3 +- command-signatures/json/scc.json | 3 +- command-signatures/json/shortcuts.json | 3 +- command-signatures/json/sqlite3.json | 6 +- command-signatures/json/st2.json | 30 +- command-signatures/json/subl.json | 3 +- command-signatures/json/trivy.json | 54 ++-- command-signatures/json/ts-node.json | 3 +- command-signatures/json/tsc.json | 3 +- command-signatures/json/vsce.json | 6 +- command-signatures/json/wasm-bindgen.json | 3 +- command-signatures/json/xcodeproj.json | 18 +- command-signatures/json/yarn.json | 11 +- command-signatures/json/youtube-dl.json | 9 +- command-signatures/src/generators/bun.rs | 3 + command-signatures/src/generators/cargo.rs | 8 +- .../src/generators/cloudflared.rs | 7 + command-signatures/src/generators/cmd_n.rs | 18 +- command-signatures/src/generators/dd.rs | 9 + command-signatures/src/generators/degit.rs | 12 + .../src/generators/deployctl.rs | 20 +- command-signatures/src/generators/dtm.rs | 18 +- command-signatures/src/generators/elixir.rs | 6 + command-signatures/src/generators/esbuild.rs | 9 + command-signatures/src/generators/expo.rs | 7 + command-signatures/src/generators/expo_cli.rs | 7 + .../src/generators/fig_token.rs | 132 +++++++- command-signatures/src/generators/file.rs | 9 + command-signatures/src/generators/git_flow.rs | 9 + command-signatures/src/generators/iex.rs | 6 + command-signatures/src/generators/java.rs | 8 + command-signatures/src/generators/julia.rs | 8 + command-signatures/src/generators/man.rs | 86 ++--- command-signatures/src/generators/meteor.rs | 3 +- command-signatures/src/generators/mix.rs | 18 +- command-signatures/src/generators/mod.rs | 46 +++ command-signatures/src/generators/ni.rs | 9 + command-signatures/src/generators/npm.rs | 21 ++ .../src/generators/osascript.rs | 6 + .../src/generators/output_parsers.rs | 91 ++++++ command-signatures/src/generators/pandoc.rs | 4 +- command-signatures/src/generators/pdfunite.rs | 6 + command-signatures/src/generators/pm2.rs | 6 + command-signatures/src/generators/pod.rs | 6 + command-signatures/src/generators/r.rs | 21 +- command-signatures/src/generators/rancher.rs | 18 +- command-signatures/src/generators/robot.rs | 39 ++- command-signatures/src/generators/rollup.rs | 7 + command-signatures/src/generators/rscript.rs | 6 + command-signatures/src/generators/rush.rs | 24 +- command-signatures/src/generators/scc.rs | 21 +- .../src/generators/shortcuts.rs | 3 +- command-signatures/src/generators/sqlite3.rs | 7 + command-signatures/src/generators/st2.rs | 9 + command-signatures/src/generators/subl.rs | 7 + .../src/generators/template_filters.rs | 305 +++++++++++++++++- command-signatures/src/generators/ts_node.rs | 1 + command-signatures/src/generators/tsc.rs | 6 + command-signatures/src/generators/vsce.rs | 20 +- .../src/generators/wasm_bindgen.rs | 7 + .../src/generators/xcodeproj.rs | 7 + 104 files changed, 1467 insertions(+), 374 deletions(-) create mode 100644 command-signatures/src/generators/cloudflared.rs create mode 100644 command-signatures/src/generators/dd.rs create mode 100644 command-signatures/src/generators/degit.rs create mode 100644 command-signatures/src/generators/elixir.rs create mode 100644 command-signatures/src/generators/esbuild.rs create mode 100644 command-signatures/src/generators/file.rs create mode 100644 command-signatures/src/generators/git_flow.rs create mode 100644 command-signatures/src/generators/iex.rs create mode 100644 command-signatures/src/generators/java.rs create mode 100644 command-signatures/src/generators/julia.rs create mode 100644 command-signatures/src/generators/ni.rs create mode 100644 command-signatures/src/generators/osascript.rs create mode 100644 command-signatures/src/generators/pdfunite.rs create mode 100644 command-signatures/src/generators/pm2.rs create mode 100644 command-signatures/src/generators/pod.rs create mode 100644 command-signatures/src/generators/rollup.rs create mode 100644 command-signatures/src/generators/rscript.rs create mode 100644 command-signatures/src/generators/sqlite3.rs create mode 100644 command-signatures/src/generators/st2.rs create mode 100644 command-signatures/src/generators/subl.rs create mode 100644 command-signatures/src/generators/tsc.rs create mode 100644 command-signatures/src/generators/wasm_bindgen.rs create mode 100644 command-signatures/src/generators/xcodeproj.rs diff --git a/command-signatures/json/apt.json b/command-signatures/json/apt.json index ad3af09c..68c29e7e 100644 --- a/command-signatures/json/apt.json +++ b/command-signatures/json/apt.json @@ -9,12 +9,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] } ] }, @@ -43,12 +47,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -77,12 +85,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -100,7 +112,8 @@ "name": "package", "description": "The package you want to install", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "generatorName": "list_prefix" }, "options": [ { @@ -117,12 +130,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -157,12 +174,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -186,12 +207,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -222,12 +247,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -248,12 +277,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -289,12 +322,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] } ] }, @@ -304,7 +341,8 @@ "args": { "name": "package", "description": "The package you want to show", - "template": "filepaths" + "template": "filepaths", + "generatorName": "list_prefix" } }, { @@ -314,7 +352,8 @@ "name": "package", "description": "The package you want to satisfy", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "generatorName": "list_prefix" }, "options": [ { @@ -331,12 +370,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -354,12 +397,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -377,12 +424,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] } ] }, @@ -393,7 +444,8 @@ "name": "package", "description": "The package you want to get source files for", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "generatorName": "list_prefix" }, "options": [ { @@ -410,12 +462,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -428,7 +484,9 @@ "name": "--compile", "description": "Compile the package to a binary using dpkg-buildpackage" }, - { "name": "--only-source" }, + { + "name": "--only-source" + }, { "name": "--host-architecture", "description": "The architecture to build for", @@ -445,7 +503,8 @@ "args": { "name": "package", "description": "The package you want to build dependencies for", - "template": "filepaths" + "template": "filepaths", + "generatorName": "list_prefix" }, "options": [ { @@ -462,12 +521,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -484,7 +547,9 @@ "description": "The architecture to build for" } }, - { "name": "--only-source" } + { + "name": "--only-source" + } ] }, { @@ -493,7 +558,8 @@ "args": { "name": "package", "description": "The package you want to download", - "template": "filepaths" + "template": "filepaths", + "generatorName": "list_prefix" }, "options": [ { @@ -510,12 +576,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] } ] }, @@ -540,12 +610,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] }, { "name": [ @@ -563,7 +637,8 @@ "name": "package", "description": "The package you want to show the changelog for", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "list_prefix" }, "options": [ { @@ -580,12 +655,16 @@ { "name": "-y", "description": "Assume yes to all prompts", - "exclusiveOn": ["--assume-no"] + "exclusiveOn": [ + "--assume-no" + ] }, { "name": "--assume-no", "description": "Assume no to all prompts", - "exclusiveOn": ["-y"] + "exclusiveOn": [ + "-y" + ] } ] } diff --git a/command-signatures/json/brew.json b/command-signatures/json/brew.json index a176cdc9..c22cc161 100644 --- a/command-signatures/json/brew.json +++ b/command-signatures/json/brew.json @@ -287,7 +287,8 @@ "--analytics" ], "args": { - "template": "filepaths" + "template": "filepaths", + "generatorName": "gist_logs_actions" } }, { @@ -388,7 +389,8 @@ "--analytics" ], "args": { - "template": "filepaths" + "template": "filepaths", + "generatorName": "gist_logs_actions" } }, { diff --git a/command-signatures/json/bun.json b/command-signatures/json/bun.json index 90091356..e69ec2ea 100644 --- a/command-signatures/json/bun.json +++ b/command-signatures/json/bun.json @@ -551,7 +551,8 @@ "args": { "name": "package", "debounce": true, - "template": "filepaths" + "template": "filepaths", + "generatorName": "npms_search" } }, { diff --git a/command-signatures/json/cargo.json b/command-signatures/json/cargo.json index fa65cf17..618ce45d 100644 --- a/command-signatures/json/cargo.json +++ b/command-signatures/json/cargo.json @@ -33,7 +33,8 @@ "args": { "name": "test", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "test_list" } }, { @@ -113,7 +114,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -322,7 +324,8 @@ "args": { "name": "test", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "test_list" } }, { @@ -379,7 +382,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -585,7 +589,8 @@ "args": { "name": "test", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "test_list" } }, { @@ -635,7 +640,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -795,7 +801,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -1212,7 +1219,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -1351,7 +1359,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -1487,7 +1496,8 @@ "args": { "name": "test", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "test_list" } }, { @@ -1537,7 +1547,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -1701,7 +1712,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -2236,7 +2248,8 @@ "name": "crate", "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "crates_io_search" } }, { @@ -2248,7 +2261,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -2506,7 +2520,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -2915,7 +2930,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -3043,7 +3059,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -3163,7 +3180,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -3287,7 +3305,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -3653,7 +3672,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -3811,7 +3831,8 @@ "args": { "name": "test", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "test_list" } }, { @@ -3876,7 +3897,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -4062,7 +4084,8 @@ "args": { "name": "test", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "test_list" } }, { @@ -4112,7 +4135,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -4335,7 +4359,8 @@ "template": "filepaths", "debounce": true, "isVariadic": true, - "suggestCurrentToken": true + "suggestCurrentToken": true, + "generatorName": "crates_io_search" } }, { @@ -4371,7 +4396,8 @@ "args": { "name": "test", "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "generatorName": "test_list" } }, { @@ -4451,7 +4477,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -4621,7 +4648,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -4984,7 +5012,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -5075,7 +5104,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -5191,7 +5221,8 @@ "description": "Path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -5602,7 +5633,8 @@ "description": "Path to the Cargo.toml file to use", "args": { "name": "PATH", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-rs" } }, { @@ -5724,7 +5756,8 @@ "name": "--", "description": "All other arguments are passed to rustfmt", "args": { - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-rs" }, "options": [ { @@ -5749,7 +5782,8 @@ "name": "--config-path", "description": "Path for the configuration file", "args": { - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-rustfmt-toml" } }, { @@ -5839,7 +5873,8 @@ "description": "Specify path to Cargo.toml", "args": { "name": "manifest-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-toml" } }, { @@ -5990,7 +6025,8 @@ "description": "Stdin" } ], - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-cargo-lock" } }, { @@ -6200,7 +6236,8 @@ "name": "DEP_ID", "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "crates_io_search" } } ], diff --git a/command-signatures/json/chown.json b/command-signatures/json/chown.json index a7af1c8d..c87460e3 100644 --- a/command-signatures/json/chown.json +++ b/command-signatures/json/chown.json @@ -4,7 +4,8 @@ "args": [ { "name": "owner[:group] or :group", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" }, { "name": "file/directory", diff --git a/command-signatures/json/cloudflared.json b/command-signatures/json/cloudflared.json index bd341fe0..98dce050 100644 --- a/command-signatures/json/cloudflared.json +++ b/command-signatures/json/cloudflared.json @@ -708,7 +708,8 @@ "args": { "name": "value", "description": "Config file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" }, "isRequired": true }, @@ -1239,7 +1240,8 @@ "args": { "name": "value", "description": "Config file in YAML", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -1554,7 +1556,8 @@ "args": { "name": "value", "description": "Config file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -1790,7 +1793,8 @@ "args": { "name": "value", "description": "Config file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -1964,7 +1968,8 @@ "args": { "name": "value", "description": "Config file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -2122,7 +2127,8 @@ "args": { "name": "value", "description": "Config file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -2280,7 +2286,8 @@ "args": { "name": "value", "description": "Config file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -2443,7 +2450,8 @@ "args": { "name": "value", "description": "Config file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { diff --git a/command-signatures/json/dd.json b/command-signatures/json/dd.json index 8abf23be..03e0996b 100644 --- a/command-signatures/json/dd.json +++ b/command-signatures/json/dd.json @@ -114,7 +114,7 @@ "requiresSeparator": true, "args": { "name": "value", - "template": "filepaths" + "generatorName": "conv_remaining" } } ] diff --git a/command-signatures/json/degit.json b/command-signatures/json/degit.json index 862d1da0..e332648f 100644 --- a/command-signatures/json/degit.json +++ b/command-signatures/json/degit.json @@ -4,7 +4,7 @@ "args": [ { "name": "user/repo", - "template": "filepaths" + "generatorName": "github_user_repos" }, { "name": "location", diff --git a/command-signatures/json/deployctl.json b/command-signatures/json/deployctl.json index 4c4f2d82..2f073e83 100644 --- a/command-signatures/json/deployctl.json +++ b/command-signatures/json/deployctl.json @@ -7,7 +7,8 @@ "description": "Deploy a script with static files to Deno Deploy", "args": { "name": "entrypoint", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-deployctl" }, "options": [ { diff --git a/command-signatures/json/direnv.json b/command-signatures/json/direnv.json index a232ea04..029d1c88 100644 --- a/command-signatures/json/direnv.json +++ b/command-signatures/json/direnv.json @@ -169,7 +169,8 @@ }, { "name": "PATH_TO_DOTENV", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-envrc" } ] }, diff --git a/command-signatures/json/docker.json b/command-signatures/json/docker.json index ab4ca986..e848c8f0 100644 --- a/command-signatures/json/docker.json +++ b/command-signatures/json/docker.json @@ -177,7 +177,8 @@ "description": "Set the target build stage to build", "args": { "name": "target build stage", - "template": "filepaths" + "template": "filepaths", + "generatorName": "from_as" } } ] @@ -1495,7 +1496,8 @@ "args": { "name": "NAME[:TAG|@DIGEST]", "template": "filepaths", - "debounce": true + "debounce": true, + "generatorName": "search" }, "options": [ { @@ -2928,7 +2930,8 @@ "description": "Set the target build stage to build", "args": { "name": "target build stage", - "template": "filepaths" + "template": "filepaths", + "generatorName": "from_as" } } ] @@ -5639,7 +5642,8 @@ "description": "Set the target build stage to build", "args": { "name": "target build stage", - "template": "filepaths" + "template": "filepaths", + "generatorName": "from_as" } } ] @@ -5838,7 +5842,8 @@ "args": { "name": "NAME[:TAG|@DIGEST]", "template": "filepaths", - "debounce": true + "debounce": true, + "generatorName": "search" }, "options": [ { diff --git a/command-signatures/json/dtm.json b/command-signatures/json/dtm.json index 09baab82..9c0025d2 100644 --- a/command-signatures/json/dtm.json +++ b/command-signatures/json/dtm.json @@ -15,7 +15,8 @@ "args": { "name": "config-file", "default": "config.yaml", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -97,7 +98,8 @@ "args": { "name": "config-file", "default": "config.yaml", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -137,7 +139,8 @@ "args": { "name": "config-file", "default": "config.yaml", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -210,7 +213,8 @@ "args": { "name": "config-file", "default": "config.yaml", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { @@ -340,7 +344,8 @@ "args": { "name": "config-file", "default": "config.yaml", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" } }, { diff --git a/command-signatures/json/elixir.json b/command-signatures/json/elixir.json index 2b92d776..5d2d5e3c 100644 --- a/command-signatures/json/elixir.json +++ b/command-signatures/json/elixir.json @@ -5,7 +5,8 @@ { "name": "file", "description": ".exs file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-exs" }, { "name": "data", diff --git a/command-signatures/json/esbuild.json b/command-signatures/json/esbuild.json index 0be3a385..d0c36f23 100644 --- a/command-signatures/json/esbuild.json +++ b/command-signatures/json/esbuild.json @@ -56,7 +56,7 @@ "requiresSeparator": ":", "args": { "name": "loaders", - "template": "filepaths" + "generatorName": "loader" }, "priority": 51 }, @@ -160,7 +160,7 @@ "requiresSeparator": ":", "args": { "name": "ext=text[,ext=text...]", - "template": "filepaths" + "generatorName": "loader" } }, { @@ -218,7 +218,7 @@ "requiresSeparator": ":", "args": { "name": "ext=text", - "template": "filepaths" + "generatorName": "loader" } }, { @@ -239,7 +239,7 @@ "requiresSeparator": ":", "args": { "name": "import", - "template": "filepaths" + "generatorName": "loader" } }, { @@ -333,7 +333,7 @@ "requiresSeparator": ":", "args": { "name": "identifier:level", - "template": "filepaths" + "generatorName": "loader" } }, { @@ -403,7 +403,7 @@ "requiresSeparator": ":", "args": { "name": "ext=new", - "template": "filepaths" + "generatorName": "loader" } }, { @@ -433,7 +433,8 @@ "description": "Mark the name as a pure function for tree shaking", "requiresSeparator": ":", "args": { - "name": "name" + "name": "name", + "generatorName": "loader" } }, { @@ -516,7 +517,7 @@ "requiresSeparator": ":", "args": { "name": "syntax=status", - "template": "filepaths" + "generatorName": "loader" } }, { diff --git a/command-signatures/json/eslint.json b/command-signatures/json/eslint.json index 57af6dac..a21b8df2 100644 --- a/command-signatures/json/eslint.json +++ b/command-signatures/json/eslint.json @@ -22,7 +22,8 @@ "name": "--env", "description": "Specify environments", "args": { - "template": "filepaths" + "template": "filepaths", + "generatorName": "env_remaining" } }, { diff --git a/command-signatures/json/expo-cli.json b/command-signatures/json/expo-cli.json index a1995113..48b73299 100644 --- a/command-signatures/json/expo-cli.json +++ b/command-signatures/json/expo-cli.json @@ -1852,7 +1852,8 @@ "isOptional": true, "isVariadic": true, "name": "packages", - "debounce": true + "debounce": true, + "generatorName": "npms_search" }, "options": [ { diff --git a/command-signatures/json/expo.json b/command-signatures/json/expo.json index 5b488fde..f31156ab 100644 --- a/command-signatures/json/expo.json +++ b/command-signatures/json/expo.json @@ -1852,7 +1852,8 @@ "isOptional": true, "isVariadic": true, "name": "packages", - "debounce": true + "debounce": true, + "generatorName": "npms_search" }, "options": [ { diff --git a/command-signatures/json/file.json b/command-signatures/json/file.json index b92358ee..702449fc 100644 --- a/command-signatures/json/file.json +++ b/command-signatures/json/file.json @@ -189,7 +189,7 @@ "isRepeatable": true, "args": { "name": "name=value", - "template": "filepaths" + "generatorName": "param_keys" } }, { diff --git a/command-signatures/json/gh.json b/command-signatures/json/gh.json index 6d69e7f4..7c050a70 100644 --- a/command-signatures/json/gh.json +++ b/command-signatures/json/gh.json @@ -2044,7 +2044,10 @@ { "name": "repository", "template": "filepaths", - "generatorName": "api_graphql_string_viewer" + "generatorName": [ + "api_graphql_string_viewer", + "repo_list_owner" + ] }, { "name": "directory", @@ -2251,7 +2254,10 @@ "args": { "name": "repository", "template": "filepaths", - "generatorName": "api_graphql_string_viewer" + "generatorName": [ + "api_graphql_string_viewer", + "repo_list_owner" + ] }, "options": [ { @@ -2425,7 +2431,10 @@ "name": "repository", "isOptional": true, "template": "filepaths", - "generatorName": "api_graphql_string_viewer" + "generatorName": [ + "api_graphql_string_viewer", + "repo_list_owner" + ] }, "options": [ { diff --git a/command-signatures/json/git-flow.json b/command-signatures/json/git-flow.json index 1ebdf26e..4aafcbf4 100644 --- a/command-signatures/json/git-flow.json +++ b/command-signatures/json/git-flow.json @@ -34,7 +34,7 @@ "args": { "name": "name", "description": "The name of the feature branch to finish", - "template": "filepaths" + "generatorName": "type_branches" } }, { @@ -79,7 +79,7 @@ "args": { "name": "name", "description": "The name of the release branch to finish", - "template": "filepaths" + "generatorName": "type_branches" } } ] @@ -102,7 +102,7 @@ "args": { "name": "name", "description": "The name of the hotfix branch to finish", - "template": "filepaths" + "generatorName": "type_branches" } } ] diff --git a/command-signatures/json/hub.json b/command-signatures/json/hub.json index 181f5de5..b3abc90f 100644 --- a/command-signatures/json/hub.json +++ b/command-signatures/json/hub.json @@ -2,7 +2,6 @@ "name": "git", "description": "The stupid content tracker", "generateSpec": "_NuFrRa_(o,t)=>p(void 0,null,function*(){let r=(yield t(\"compgen -c | grep git- | cut -c5- | sort -u\")).trim();return r===\"\"?{name:\"git\"}:{name:\"git\",subcommands:r.split(`\n`).map(a=>{var s;return f({name:a},(s=q[a])!=null?s:{description:`Run git-${a}`})})}})", - "args": { "name": "alias", "description": "Custom user defined git alias", @@ -4069,7 +4068,10 @@ } ], "template": "filepaths", - "generatorName": "log" + "generatorName": [ + "log", + "status_staged_or_unstaged" + ] } }, { diff --git a/command-signatures/json/iex.json b/command-signatures/json/iex.json index 3e97be67..d6364841 100644 --- a/command-signatures/json/iex.json +++ b/command-signatures/json/iex.json @@ -5,7 +5,8 @@ { "name": "file", "description": ".exs file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-exs" }, { "name": "data", diff --git a/command-signatures/json/java.json b/command-signatures/json/java.json index 5026a5e8..1f0fd245 100644 --- a/command-signatures/json/java.json +++ b/command-signatures/json/java.json @@ -7,7 +7,8 @@ "args": { "name": "mainclass", "description": "To launch a class file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-java-class" }, "options": [ { @@ -16,7 +17,8 @@ "description": "To launch the main class in a JAR file", "args": { "name": "JAR file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-jar" } }, { diff --git a/command-signatures/json/julia.json b/command-signatures/json/julia.json index 26edad8f..c4a97a88 100644 --- a/command-signatures/json/julia.json +++ b/command-signatures/json/julia.json @@ -45,7 +45,8 @@ "description": "Start up with the given system image file", "args": { "name": "system image", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-dylib-so-dll" } }, { @@ -144,7 +145,8 @@ "description": "Load given file immediately on all processors", "args": { "name": "julia script", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-jl" } }, { @@ -510,6 +512,7 @@ "name": "julia script", "isScript": true, "isOptional": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-jl" } } diff --git a/command-signatures/json/limactl.json b/command-signatures/json/limactl.json index 4612c7ae..f5cb47c6 100644 --- a/command-signatures/json/limactl.json +++ b/command-signatures/json/limactl.json @@ -420,7 +420,8 @@ "args": { "name": "FILE.yaml", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yml-yaml" }, "options": [ { diff --git a/command-signatures/json/man.json b/command-signatures/json/man.json index 7a6c9809..c5149e1b 100644 --- a/command-signatures/json/man.json +++ b/command-signatures/json/man.json @@ -104,7 +104,7 @@ "description": "Specify a colon-separated list of manual sections to search", "args": { "name": "sections", - "template": "filepaths" + "generatorName": "sections_remaining" } }, { diff --git a/command-signatures/json/meteor.json b/command-signatures/json/meteor.json index 92047358..a365abfd 100644 --- a/command-signatures/json/meteor.json +++ b/command-signatures/json/meteor.json @@ -103,7 +103,8 @@ "description": "Set optional data for Meteor.settings on the server", "args": { "name": "JSON File", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" } }, { @@ -464,7 +465,8 @@ "description": "Set optional data for Meteor.settings", "args": { "name": "JSON File", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" } }, { @@ -633,7 +635,8 @@ "description": "Set optional data for Meteor.settings on the server", "args": { "name": "JSON File", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" } }, { @@ -753,7 +756,8 @@ "description": "Set optional data for Meteor.settings on the server", "args": { "name": "JSON File", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" } }, { @@ -905,7 +909,8 @@ "description": "Publishes a new release to the package server, as determined by a JSON configuration file", "args": { "name": "JSON File", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" }, "options": [ { diff --git a/command-signatures/json/mix.json b/command-signatures/json/mix.json index 0e07cbf7..fbd6b5fc 100644 --- a/command-signatures/json/mix.json +++ b/command-signatures/json/mix.json @@ -46,7 +46,8 @@ "args": { "name": "file", "template": "filepaths", - "isOptional": true + "isOptional": true, + "filterTemplateName": "filter-exs" }, "options": [ { @@ -78,7 +79,8 @@ "args": { "name": "file|pattern", "description": "The file|pattern to execute", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-exs" } }, { @@ -89,7 +91,8 @@ "description": "Executes the given pattern/file", "args": { "name": "file|pattern", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-exs" } }, { diff --git a/command-signatures/json/n.json b/command-signatures/json/n.json index 128de5d6..06cd8c1b 100644 --- a/command-signatures/json/n.json +++ b/command-signatures/json/n.json @@ -198,7 +198,8 @@ { "name": "node script", "isScript": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-js-ts-family" } ], "options": [ diff --git a/command-signatures/json/ni.json b/command-signatures/json/ni.json index ce537e2b..2f5df192 100644 --- a/command-signatures/json/ni.json +++ b/command-signatures/json/ni.json @@ -43,6 +43,7 @@ "name": "package", "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" } } diff --git a/command-signatures/json/npm.json b/command-signatures/json/npm.json index ea812537..8a6f265c 100644 --- a/command-signatures/json/npm.json +++ b/command-signatures/json/npm.json @@ -374,7 +374,8 @@ "isOptional": true, "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" }, "options": [ { @@ -599,7 +600,8 @@ "isOptional": true, "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" }, "options": [ { @@ -1639,7 +1641,8 @@ "isOptional": true, "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" }, "options": [ { diff --git a/command-signatures/json/nx.json b/command-signatures/json/nx.json index a39e449a..30cdf352 100644 --- a/command-signatures/json/nx.json +++ b/command-signatures/json/nx.json @@ -228,7 +228,8 @@ "description": "Run a generator", "args": { "template": "filepaths", - "name": "collection:generator" + "name": "collection:generator", + "generatorName": "plugin_list" }, "options": [ { diff --git a/command-signatures/json/osascript.json b/command-signatures/json/osascript.json index 3b535533..771fe85d 100644 --- a/command-signatures/json/osascript.json +++ b/command-signatures/json/osascript.json @@ -51,6 +51,7 @@ "name": "script", "isScript": true, "isOptional": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-scpt" } } diff --git a/command-signatures/json/pandoc.json b/command-signatures/json/pandoc.json index def83fe7..742548e1 100644 --- a/command-signatures/json/pandoc.json +++ b/command-signatures/json/pandoc.json @@ -55,7 +55,8 @@ "description": "Specify a set of default option settings", "args": { "name": "file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yaml" } }, { @@ -184,7 +185,8 @@ "description": "Read metadata from the supplied YAML (or JSON) file", "args": { "name": "file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-yaml-json" } }, { diff --git a/command-signatures/json/pdfunite.json b/command-signatures/json/pdfunite.json index 545e8037..beb2d99c 100644 --- a/command-signatures/json/pdfunite.json +++ b/command-signatures/json/pdfunite.json @@ -17,6 +17,7 @@ ], "args": { "template": "filepaths", - "isVariadic": true + "isVariadic": true, + "filterTemplateName": "filter-pdf" } } diff --git a/command-signatures/json/pm2.json b/command-signatures/json/pm2.json index 77e9c720..ae688f7c 100644 --- a/command-signatures/json/pm2.json +++ b/command-signatures/json/pm2.json @@ -426,7 +426,8 @@ "description": "Start or restart JSON file", "args": { "name": "json", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" } }, { @@ -434,7 +435,8 @@ "description": "Start or gracefully reload JSON file", "args": { "name": "json", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" } }, { @@ -450,7 +452,8 @@ "description": "Start or gracefully reolad JSON file", "args": { "name": "json", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json" } }, { diff --git a/command-signatures/json/pnpm.json b/command-signatures/json/pnpm.json index ddefc84f..aa1bf26f 100644 --- a/command-signatures/json/pnpm.json +++ b/command-signatures/json/pnpm.json @@ -131,7 +131,6 @@ ], "description": "Pnpm install is used to install all dependencies for a project.\nIn a CI environment, installation fails if a lockfile is present but needs an update.\nInside a workspace, pnpm install installs all dependencies in all the projects.\nIf you want to disable this behavior, set the recursive-install setting to false", "generateSpec": "_NuFrRa_generateSpec(e){return h(this,null,function*(){let n=e.filter(t=>t.trim()!==\"\"&&!t.startsWith(\"-\")).length>2;return{name:\"install\",options:[...F,...n?G:M]}})}", - "args": { "name": "package", "isOptional": true, @@ -916,7 +915,8 @@ "name": "package", "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" }, "options": [ { @@ -1019,13 +1019,13 @@ ], "description": "Pnpm install is used to install all dependencies for a project.\nIn a CI environment, installation fails if a lockfile is present but needs an update.\nInside a workspace, pnpm install installs all dependencies in all the projects.\nIf you want to disable this behavior, set the recursive-install setting to false", "generateSpec": "_NuFrRa_generateSpec(e){return h(this,null,function*(){let n=e.filter(t=>t.trim()!==\"\"&&!t.startsWith(\"-\")).length>2;return{name:\"install\",options:[...F,...n?G:M]}})}", - "args": { "name": "package", "isOptional": true, "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" } }, { diff --git a/command-signatures/json/pod.json b/command-signatures/json/pod.json index 599850d2..e87f7130 100644 --- a/command-signatures/json/pod.json +++ b/command-signatures/json/pod.json @@ -308,7 +308,8 @@ "args": { "name": "NAME.podspec|DIRECTORY|http://PATH/NAME.podspec", "isOptional": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-podspec" } } ] @@ -682,7 +683,8 @@ "description": "Additional ancillary podspecs which are used for linting via :path", "args": { "name": "podspec", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-podspec" } }, { @@ -690,7 +692,8 @@ "description": "Additional ancillary podspecs which are used for linting via :podspec. If there are --include-podspecs, then these are removed from them", "args": { "name": "podspec", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-podspec" } }, { @@ -727,7 +730,8 @@ "args": { "name": "PODSPEC_PATHS", "isOptional": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-podspec" } } ] @@ -869,7 +873,8 @@ { "name": "NAME.podspec", "isOptional": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-podspec" } ] }, diff --git a/command-signatures/json/r.json b/command-signatures/json/r.json index c3e89819..595ef6b0 100644 --- a/command-signatures/json/r.json +++ b/command-signatures/json/r.json @@ -41,7 +41,8 @@ { "name": "infile", "description": "A file with R code to be executed", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-r-src" }, { "name": "outfile", @@ -72,7 +73,8 @@ "name": "files", "description": "Source files to be compiled", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-r-archive" } }, { @@ -149,7 +151,8 @@ "name": "files", "description": "The object files to be included in the shared object/DLL", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-r-archive" } }, { @@ -789,7 +792,8 @@ "name": "packages", "description": "Packages to check", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-r-archive" } }, { @@ -989,7 +993,8 @@ "args": { "name": "file", "description": "R doc file to convert", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-rd" } }, { @@ -1225,7 +1230,8 @@ "args": { "name": "file", "description": "R doc file to convert", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-r" } }, { @@ -1849,7 +1855,8 @@ "args": { "name": "file", "description": "File to run", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-r" } }, { diff --git a/command-signatures/json/rancher.json b/command-signatures/json/rancher.json index 8649cb63..3973799f 100644 --- a/command-signatures/json/rancher.json +++ b/command-signatures/json/rancher.json @@ -43,7 +43,8 @@ "description": "Path to an answers file, the format of the file is a map with key:value. This supports JSON and YAML", "args": { "name": "answers-file-path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-json-yaml" } }, { diff --git a/command-signatures/json/robot.json b/command-signatures/json/robot.json index 3a1e9dfb..ade0b083 100644 --- a/command-signatures/json/robot.json +++ b/command-signatures/json/robot.json @@ -5,7 +5,8 @@ "name": "robot script", "isScript": true, "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-robot" }, "options": [ { @@ -82,7 +83,7 @@ "description": "Select tests by name or by long name containing also parent suite name like `Parent.Test`", "args": { "name": "name", - "generatorName": "for_i_in_robot" + "generatorName": "test_cases" } }, { @@ -90,7 +91,7 @@ "description": "Alias to --test. Especially applicable with --rpa", "args": { "name": "name", - "generatorName": "for_i_in_robot" + "generatorName": "test_cases" } }, { @@ -133,7 +134,8 @@ "description": "Select failed tests from an earlier output file to be re-executed", "args": { "name": "output file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-xml" } }, { @@ -144,7 +146,8 @@ "description": "Select failed suites from an earlier output file to be re-executed", "args": { "name": "output file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-xml" } }, { @@ -175,7 +178,7 @@ "description": "Set variables in the test data", "args": { "name": "variable", - "template": "filepaths" + "generatorName": "variables" } }, { @@ -186,7 +189,8 @@ "description": "Python or YAML file file to read variables from", "args": { "name": "file", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-py-yaml" } }, { @@ -386,7 +390,7 @@ "description": "Include only matching tags in `Statistics by Tag` in log and report", "args": { "name": "tag", - "generatorName": "for_i_in_robot" + "generatorName": "test_cases" } }, { @@ -394,7 +398,7 @@ "description": "Exclude matching tags from `Statistics by Tag`", "args": { "name": "tag", - "generatorName": "for_i_in_robot" + "generatorName": "test_cases" } }, { @@ -402,7 +406,7 @@ "description": "Create combined statistics based on tags. These statistics are added into `Statistics by Tag`", "args": { "name": "tags:name", - "generatorName": "for_i_in_robot" + "generatorName": "test_cases" } }, { @@ -410,7 +414,7 @@ "description": "Add documentation to tags matching the given pattern", "args": { "name": "pattern:doc", - "generatorName": "for_i_in_robot" + "generatorName": "test_cases" } }, { @@ -418,7 +422,7 @@ "description": "Add external links into `Statistics by Tag`. Pattern can use `*`, `?` and `[]` as wildcards", "args": { "name": "pattern:link:title", - "generatorName": "for_i_in_robot" + "generatorName": "test_cases" } }, { @@ -718,7 +722,8 @@ "description": "Additional locations (directories, ZIPs) where to search libraries and other extensions when they are imported", "args": { "name": "path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-zip" } }, { diff --git a/command-signatures/json/rollup.json b/command-signatures/json/rollup.json index 95949235..2cc8c5ff 100644 --- a/command-signatures/json/rollup.json +++ b/command-signatures/json/rollup.json @@ -10,7 +10,8 @@ "description": "Use this config file (if argument is used but value is unspecified, defaults to rollup.config.js)", "args": { "name": "filename", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-config-js" } }, { diff --git a/command-signatures/json/rscript.json b/command-signatures/json/rscript.json index 6c447880..855729cc 100644 --- a/command-signatures/json/rscript.json +++ b/command-signatures/json/rscript.json @@ -70,7 +70,8 @@ "name": "file", "description": "R script to run", "isScript": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-r" }, { "name": "args", diff --git a/command-signatures/json/rush.json b/command-signatures/json/rush.json index 1eba6449..0c34597f 100644 --- a/command-signatures/json/rush.json +++ b/command-signatures/json/rush.json @@ -17,7 +17,8 @@ "args": { "name": "PACKAGE", "template": "filepaths", - "debounce": true + "debounce": true, + "generatorName": "npms_search" } }, { diff --git a/command-signatures/json/scc.json b/command-signatures/json/scc.json index 3e239779..094c1ab1 100644 --- a/command-signatures/json/scc.json +++ b/command-signatures/json/scc.json @@ -109,7 +109,8 @@ { "name": "sql-insert" } - ] + ], + "generatorName": "format_multi" } }, { diff --git a/command-signatures/json/shortcuts.json b/command-signatures/json/shortcuts.json index 87bac52f..c3e18c91 100644 --- a/command-signatures/json/shortcuts.json +++ b/command-signatures/json/shortcuts.json @@ -110,7 +110,8 @@ "description": "The shortcut file to sign", "args": { "name": "input", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-shortcut" } }, { diff --git a/command-signatures/json/sqlite3.json b/command-signatures/json/sqlite3.json index f19bbd7d..61916890 100644 --- a/command-signatures/json/sqlite3.json +++ b/command-signatures/json/sqlite3.json @@ -6,7 +6,8 @@ }, "args": { "name": "FILENAME", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-sqlite" }, "options": [ { @@ -49,7 +50,8 @@ "description": "Read/process named file", "args": { "name": "FILENAME", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-sqlite" } }, { diff --git a/command-signatures/json/st2.json b/command-signatures/json/st2.json index 54b7acd5..262bff0e 100644 --- a/command-signatures/json/st2.json +++ b/command-signatures/json/st2.json @@ -126,7 +126,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } } ], @@ -662,7 +663,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } } ], @@ -1104,7 +1106,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } } ], @@ -1340,7 +1343,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } }, { @@ -1468,7 +1472,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } }, { @@ -1861,7 +1866,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } }, { @@ -2705,7 +2711,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } }, { @@ -2860,7 +2867,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } } ], @@ -2950,7 +2958,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } } ], @@ -6923,7 +6932,8 @@ "description": "User under which to run the action (admins only)", "args": { "name": "USER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "users_or_groups" } }, { diff --git a/command-signatures/json/subl.json b/command-signatures/json/subl.json index 2299a4a6..bd0f79e3 100644 --- a/command-signatures/json/subl.json +++ b/command-signatures/json/subl.json @@ -16,7 +16,8 @@ "description": "Load the given project", "args": { "name": "project", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-sublime" } }, { diff --git a/command-signatures/json/trivy.json b/command-signatures/json/trivy.json index 0a011238..534dbb37 100644 --- a/command-signatures/json/trivy.json +++ b/command-signatures/json/trivy.json @@ -45,7 +45,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { @@ -80,7 +81,8 @@ "args": { "name": "vulnType", "template": "filepaths", - "default": "os,library" + "default": "os,library", + "generatorName": "pkg_types_remaining" } }, { @@ -89,7 +91,8 @@ "args": { "name": "securityChecks", "template": "filepaths", - "default": "vuln" + "default": "vuln", + "generatorName": "scanners_remaining" } }, { @@ -244,7 +247,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { @@ -279,7 +283,8 @@ "args": { "name": "vulnType", "template": "filepaths", - "default": "os,library" + "default": "os,library", + "generatorName": "pkg_types_remaining" } }, { @@ -288,7 +293,8 @@ "args": { "name": "securityChecks", "template": "filepaths", - "default": "vuln" + "default": "vuln", + "generatorName": "scanners_remaining" } }, { @@ -469,7 +475,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { @@ -504,7 +511,8 @@ "args": { "name": "vulnType", "template": "filepaths", - "default": "os,library" + "default": "os,library", + "generatorName": "pkg_types_remaining" } }, { @@ -513,7 +521,8 @@ "args": { "name": "securityChecks", "template": "filepaths", - "default": "vuln" + "default": "vuln", + "generatorName": "scanners_remaining" } }, { @@ -669,7 +678,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { @@ -768,7 +778,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { @@ -803,7 +814,8 @@ "args": { "name": "vulnType", "template": "filepaths", - "default": "os,library" + "default": "os,library", + "generatorName": "pkg_types_remaining" } }, { @@ -812,7 +824,8 @@ "args": { "name": "securityChecks", "template": "filepaths", - "default": "vuln" + "default": "vuln", + "generatorName": "scanners_remaining" } }, { @@ -962,7 +975,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { @@ -997,7 +1011,8 @@ "args": { "name": "vulnType", "template": "filepaths", - "default": "os,library" + "default": "os,library", + "generatorName": "pkg_types_remaining" } }, { @@ -1006,7 +1021,8 @@ "args": { "name": "securityChecks", "template": "filepaths", - "default": "vuln" + "default": "vuln", + "generatorName": "scanners_remaining" } }, { @@ -1079,7 +1095,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { @@ -1269,7 +1286,8 @@ "args": { "name": "severity", "template": "filepaths", - "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", + "generatorName": "severity_remaining" } }, { diff --git a/command-signatures/json/ts-node.json b/command-signatures/json/ts-node.json index 44b752e4..2b5354fa 100644 --- a/command-signatures/json/ts-node.json +++ b/command-signatures/json/ts-node.json @@ -187,6 +187,7 @@ "args": { "name": "script", "isScript": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-ts-tsx" } } diff --git a/command-signatures/json/tsc.json b/command-signatures/json/tsc.json index 2fa53cec..3a433ec1 100644 --- a/command-signatures/json/tsc.json +++ b/command-signatures/json/tsc.json @@ -659,6 +659,7 @@ "args": { "name": "tsc script", "isScript": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-ts" } } diff --git a/command-signatures/json/vsce.json b/command-signatures/json/vsce.json index 2a1c68fb..b8db4dbd 100644 --- a/command-signatures/json/vsce.json +++ b/command-signatures/json/vsce.json @@ -49,7 +49,8 @@ "description": "Output .vsix extension file to location (defaults to -.vsix)", "args": { "name": "path", - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-vsix" } }, { @@ -225,7 +226,8 @@ "args": { "name": "paths", "isVariadic": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-vsix" } }, { diff --git a/command-signatures/json/wasm-bindgen.json b/command-signatures/json/wasm-bindgen.json index f0fdd0de..7b1bceb5 100644 --- a/command-signatures/json/wasm-bindgen.json +++ b/command-signatures/json/wasm-bindgen.json @@ -169,6 +169,7 @@ "name": "input", "description": "File name to output the compiled binary bindings", "isScript": true, - "template": "filepaths" + "template": "filepaths", + "filterTemplateName": "filter-wasm" } } diff --git a/command-signatures/json/xcodeproj.json b/command-signatures/json/xcodeproj.json index 71fd4b7f..c02d5acd 100644 --- a/command-signatures/json/xcodeproj.json +++ b/command-signatures/json/xcodeproj.json @@ -9,7 +9,8 @@ { "name": "PROJECT", "isOptional": true, - "template": "folders" + "template": "folders", + "filterTemplateName": "filter-xcodeproj" }, { "name": "OUTPUT", @@ -35,11 +36,13 @@ "args": [ { "name": "PROJECT1", - "template": "folders" + "template": "folders", + "filterTemplateName": "filter-xcodeproj" }, { "name": "PROJECT2", - "template": "folders" + "template": "folders", + "filterTemplateName": "filter-xcodeproj" } ] }, @@ -64,7 +67,8 @@ "args": { "name": "PROJECT", "isOptional": true, - "template": "folders" + "template": "folders", + "filterTemplateName": "filter-xcodeproj" } }, { @@ -87,7 +91,8 @@ "args": { "name": "PROJECT", "template": "folders", - "isOptional": true + "isOptional": true, + "filterTemplateName": "filter-xcodeproj" } }, { @@ -99,7 +104,8 @@ "description": "The Xcode project document to use", "args": { "name": "PATH", - "template": "folders" + "template": "folders", + "filterTemplateName": "filter-xcodeproj" } } ], diff --git a/command-signatures/json/yarn.json b/command-signatures/json/yarn.json index ffea8e91..4fe75073 100644 --- a/command-signatures/json/yarn.json +++ b/command-signatures/json/yarn.json @@ -2,7 +2,6 @@ "name": "yarn", "description": "Manage packages and run scripts", "generateSpec": "_NuFrRa_(e,n)=>h(void 0,null,function*(){let{script:a,postProcess:t}=R,p=t(yield n(a),e).map(({name:i})=>i).filter(i=>W.includes(i)).map(i=>({name:i===\"@redwoodjs/core\"?[\"redwood\",\"rw\"]:i,loadSpec:i===\"@redwoodjs/core\"?\"redwood\":i,icon:\"fig://icon?type=package\"}));return{name:\"yarn\",subcommands:p}})", - "aliasGenerator": "script_alias", "args": { "name": "script", @@ -495,7 +494,8 @@ "name": "package", "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" }, "options": [ { @@ -1203,7 +1203,8 @@ "name": "cli", "template": "filepaths", "loadSpec": "_NuFrRa_e=>h(void 0,null,function*(){return{name:\"create-\"+e,type:\"global\"}})", - "isCommand": true + "isCommand": true, + "generatorName": "create_package_search" }, "options": [ { @@ -1499,7 +1500,8 @@ "name": "package", "template": "filepaths", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" } }, { @@ -4917,7 +4919,6 @@ "name": "workspace", "description": "Manage workspace", "generateSpec": "_NuFrRa_(e,n)=>h(void 0,null,function*(){let t=(yield n(\"yarn --version\")).startsWith(\"1.\"),o=()=>h(void 0,null,function*(){let i=yield n(\"yarn workspaces info\"),s=i.indexOf(\"{\"),r=i.lastIndexOf(\"}\");return Object.entries(JSON.parse(i.slice(s,r+1))).map(([l,{location:f}])=>({name:l,location:f}))}),p=()=>h(void 0,null,function*(){return(yield n(\"yarn workspaces list --json\")).split(`\n`).map(s=>JSON.parse(s.trim()))});try{let s=(t?yield o():yield p()).map(({name:r,location:l})=>({name:r,description:\"Workspaces\",args:{name:\"script\",generators:{cache:{strategy:\"stale-while-revalidate\",ttl:6e4},script:`\\\\cat ${l}/package.json`,postProcess:function(f){if(f.trim()==\"\")return[];try{let A=JSON.parse(f).scripts;if(A)return Object.keys(A).map(G=>({name:G}))}catch(P){}return[]}}}}));return{name:\"workspace\",subcommands:s}}catch(i){console.error(i)}return{name:\"workspaces\"}})", - "args": { "name": "workspace", "description": "Workspace name", diff --git a/command-signatures/json/youtube-dl.json b/command-signatures/json/youtube-dl.json index ec2766a4..9579f882 100644 --- a/command-signatures/json/youtube-dl.json +++ b/command-signatures/json/youtube-dl.json @@ -160,7 +160,8 @@ "description": "Playlist video to start at (default is 1)", "args": { "name": "NUMBER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "flat_playlist" } }, { @@ -168,7 +169,8 @@ "description": "Playlist video to end at (default is last)", "args": { "name": "NUMBER", - "template": "filepaths" + "template": "filepaths", + "generatorName": "flat_playlist" } }, { @@ -176,7 +178,8 @@ "description": "Playlist video to end at (default is last)", "args": { "name": "ITEM_SPEC", - "template": "filepaths" + "template": "filepaths", + "generatorName": "flat_playlist" } }, { diff --git a/command-signatures/src/generators/bun.rs b/command-signatures/src/generators/bun.rs index 1ca2e062..5d6742fa 100644 --- a/command-signatures/src/generators/bun.rs +++ b/command-signatures/src/generators/bun.rs @@ -1,6 +1,7 @@ use warp_completion_metadata::CommandSignatureGenerators; use crate::generators::common::{dependencies_generator, get_scripts_generator}; +use crate::generators::template_filters; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("bun") @@ -13,6 +14,8 @@ pub fn generator() -> CommandSignatureGenerators { crate::generators::output_parsers::npms_search_results, ), ) + .add_filter("filter-bun-script", template_filters::bun_script()) + .add_filter("filter-js-ts-family", template_filters::js_ts_family()) } #[cfg(test)] diff --git a/command-signatures/src/generators/cargo.rs b/command-signatures/src/generators/cargo.rs index 73df07df..7780a5c6 100644 --- a/command-signatures/src/generators/cargo.rs +++ b/command-signatures/src/generators/cargo.rs @@ -1,4 +1,4 @@ -use super::{fig_token, output_parsers}; +use super::{fig_token, output_parsers, template_filters}; use std::collections::{HashMap, HashSet}; use warp_completion_metadata::{ @@ -171,4 +171,10 @@ pub fn generator() -> CommandSignatureGenerators { "test_list", Generator::command_from_tokens(fig_token::cargo_test_list, output_parsers::lines), ) + .add_filter("filter-cargo-toml", template_filters::cargo_toml()) + .add_filter("filter-cargo-lock", template_filters::cargo_lock()) + .add_filter("filter-rustfmt-toml", template_filters::rustfmt_toml()) + .add_filter("filter-deny-toml", template_filters::deny_toml()) + .add_filter("filter-rs", template_filters::rs()) + .add_filter("filter-snap", template_filters::snap()) } diff --git a/command-signatures/src/generators/cloudflared.rs b/command-signatures/src/generators/cloudflared.rs new file mode 100644 index 00000000..1ac4003e --- /dev/null +++ b/command-signatures/src/generators/cloudflared.rs @@ -0,0 +1,7 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("cloudflared") + .add_filter("filter-yml-yaml", template_filters::yml_yaml()) +} diff --git a/command-signatures/src/generators/cmd_n.rs b/command-signatures/src/generators/cmd_n.rs index 2be7586b..e5edbe0e 100644 --- a/command-signatures/src/generators/cmd_n.rs +++ b/command-signatures/src/generators/cmd_n.rs @@ -1,12 +1,14 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("n").add_generator( - "lsr", - Generator::script( - CommandBuilder::single_command("n lsr --all"), - output_parsers::lines, - ), - ) + CommandSignatureGenerators::new("n") + .add_generator( + "lsr", + Generator::script( + CommandBuilder::single_command("n lsr --all"), + output_parsers::lines, + ), + ) + .add_filter("filter-js-ts-family", template_filters::js_ts_family()) } diff --git a/command-signatures/src/generators/dd.rs b/command-signatures/src/generators/dd.rs new file mode 100644 index 00000000..c716bb74 --- /dev/null +++ b/command-signatures/src/generators/dd.rs @@ -0,0 +1,9 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("dd").add_generator( + "conv_remaining", + Generator::command_from_tokens(fig_token::dd_conv_remaining, output_parsers::lines), + ) +} diff --git a/command-signatures/src/generators/degit.rs b/command-signatures/src/generators/degit.rs new file mode 100644 index 00000000..14dfbd15 --- /dev/null +++ b/command-signatures/src/generators/degit.rs @@ -0,0 +1,12 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("degit").add_generator( + "github_user_repos", + Generator::command_from_tokens( + fig_token::github_user_repos, + output_parsers::github_repos_json, + ), + ) +} diff --git a/command-signatures/src/generators/deployctl.rs b/command-signatures/src/generators/deployctl.rs index 8c5bfdfe..2921415f 100644 --- a/command-signatures/src/generators/deployctl.rs +++ b/command-signatures/src/generators/deployctl.rs @@ -1,14 +1,16 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("deployctl").add_generator( - "deploy_versions", - Generator::script( - CommandBuilder::single_command( - "curl -sL 'https://cdn.deno.land/deploy/meta/versions.json'", + CommandSignatureGenerators::new("deployctl") + .add_generator( + "deploy_versions", + Generator::script( + CommandBuilder::single_command( + "curl -sL 'https://cdn.deno.land/deploy/meta/versions.json'", + ), + output_parsers::json_string_array, ), - output_parsers::json_string_array, - ), - ) + ) + .add_filter("filter-deployctl", template_filters::deployctl()) } diff --git a/command-signatures/src/generators/dtm.rs b/command-signatures/src/generators/dtm.rs index 0b1883b4..e426da26 100644 --- a/command-signatures/src/generators/dtm.rs +++ b/command-signatures/src/generators/dtm.rs @@ -1,12 +1,14 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("dtm").add_generator( - "list_plugins", - Generator::script( - CommandBuilder::single_command("dtm list plugins"), - output_parsers::lines, - ), - ) + CommandSignatureGenerators::new("dtm") + .add_generator( + "list_plugins", + Generator::script( + CommandBuilder::single_command("dtm list plugins"), + output_parsers::lines, + ), + ) + .add_filter("filter-yml-yaml", template_filters::yml_yaml()) } diff --git a/command-signatures/src/generators/elixir.rs b/command-signatures/src/generators/elixir.rs new file mode 100644 index 00000000..53ba7b7a --- /dev/null +++ b/command-signatures/src/generators/elixir.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("elixir").add_filter("filter-exs", template_filters::exs()) +} diff --git a/command-signatures/src/generators/esbuild.rs b/command-signatures/src/generators/esbuild.rs new file mode 100644 index 00000000..6da89fad --- /dev/null +++ b/command-signatures/src/generators/esbuild.rs @@ -0,0 +1,9 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("esbuild").add_generator( + "loader", + Generator::command_from_tokens(fig_token::esbuild_loader, output_parsers::lines), + ) +} diff --git a/command-signatures/src/generators/expo.rs b/command-signatures/src/generators/expo.rs index 5b291442..0785a517 100644 --- a/command-signatures/src/generators/expo.rs +++ b/command-signatures/src/generators/expo.rs @@ -24,4 +24,11 @@ pub fn generator() -> CommandSignatureGenerators { output_parsers::second_whitespace_token, ), ) + .add_generator( + "npms_search", + Generator::command_from_tokens( + super::fig_token::npms_search, + output_parsers::npms_search_results, + ), + ) } diff --git a/command-signatures/src/generators/expo_cli.rs b/command-signatures/src/generators/expo_cli.rs index 4ab61d21..37928f1c 100644 --- a/command-signatures/src/generators/expo_cli.rs +++ b/command-signatures/src/generators/expo_cli.rs @@ -24,4 +24,11 @@ pub fn generator() -> CommandSignatureGenerators { output_parsers::second_whitespace_token, ), ) + .add_generator( + "npms_search", + Generator::command_from_tokens( + super::fig_token::npms_search, + output_parsers::npms_search_results, + ), + ) } diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index c8179c4c..717a8614 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -205,6 +205,132 @@ pub fn brew_gist_logs_actions(tokens: &[&str], _: bool, _: &[String]) -> Command } } +pub fn github_user_repos(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let last = last_token(tokens); + if last.contains(':') || !last.contains('/') { + return CommandBuilder::single_command("true"); + } + let user = last.split('/').next().unwrap_or(""); + if user.is_empty() { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command(format!( + "curl -sL 'https://api.github.com/users/{}/repos'", + urlencode(user) + )) + } +} + +pub fn git_flow_type_branches(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let kind = tokens.get(1).copied().unwrap_or(""); + if kind.is_empty() || !kind.chars().all(|c| c.is_ascii_alphanumeric() || c == '-') { + return CommandBuilder::single_command("true"); + } + CommandBuilder::single_command(format!( + r#"p=$(git config --get gitflow.prefix.{kind} 2>/dev/null); git --no-optional-locks branch -a --no-color --sort=-committerdate | sed 's/^[*+] //; s/^ //' | awk -v p="$p" 'index($0,p)==1 {{ print substr($0,length(p)+1) }}'"# + )) +} + +pub fn dd_conv_remaining(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + remaining_csv( + tokens, + &[ + "ascii", + "oldascii", + "block", + "ebcdic", + "ibm", + "oldebcdic", + "oldibm", + "lcase", + "noerror", + "notrunc", + "osync", + "sparse", + "swab", + "sync", + "ucase", + "unblock", + ], + ) +} + +pub fn man_sections_remaining(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + remaining_delimited(tokens, &["1", "2", "3", "4", "5", "6", "7", "8"], ':') +} + +pub fn file_param_keys(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let last = last_token(tokens); + if last.contains('=') { + CommandBuilder::single_command("true") + } else { + remaining_delimited( + tokens, + &[ + "bytes", + "elf_notes", + "elf_phum", + "encoding", + "indir", + "name", + "regex", + ], + ',', + ) + } +} + +pub fn robot_variables(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + if last_token(tokens).contains(':') { + CommandBuilder::single_command("true") + } else { + CommandBuilder::single_command( + r#"for i in $(find -E . -regex ".*.(robot|resource)" -type f); do cat -s $i ; done"#, + ) + } +} + +pub fn scc_output_paths(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let last = last_token(tokens); + if last.contains(':') { + CommandBuilder::single_command("ls -1AF; printf '%s\\n' stdout") + } else { + remaining_csv( + tokens, + &[ + "tabular", + "wide", + "json", + "csv", + "csv-stream", + "cloc-yaml", + "html", + "html-table", + "sql", + "sql-insert", + ], + ) + } +} + +pub fn esbuild_loader(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { + let last = last_token(tokens); + if last.contains(':') { + remaining_delimited( + tokens, + &[ + "js", "jsx", "ts", "tsx", "css", "json", "text", "base64", "file", "dataurl", + "binary", "copy", + ], + ':', + ) + } else { + CommandBuilder::single_command( + "find . -depth 3 -type f -name '*.*' -not -path '*/node_modules/*' | sed 's/.*\\.//' | sort -u", + ) + } +} + fn curl_npms(query: &str, _: &str) -> CommandBuilder { if query.is_empty() { CommandBuilder::single_command("true") @@ -217,8 +343,12 @@ fn curl_npms(query: &str, _: &str) -> CommandBuilder { } fn remaining_csv(tokens: &[&str], options: &[&str]) -> CommandBuilder { + remaining_delimited(tokens, options, ',') +} + +fn remaining_delimited(tokens: &[&str], options: &[&str], delimiter: char) -> CommandBuilder { let used: std::collections::HashSet<&str> = last_token(tokens) - .split(',') + .split(delimiter) .filter(|s| !s.is_empty()) .collect(); let left: Vec<&str> = options diff --git a/command-signatures/src/generators/file.rs b/command-signatures/src/generators/file.rs new file mode 100644 index 00000000..ab848552 --- /dev/null +++ b/command-signatures/src/generators/file.rs @@ -0,0 +1,9 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("file").add_generator( + "param_keys", + Generator::command_from_tokens(fig_token::file_param_keys, output_parsers::lines), + ) +} diff --git a/command-signatures/src/generators/git_flow.rs b/command-signatures/src/generators/git_flow.rs new file mode 100644 index 00000000..45494775 --- /dev/null +++ b/command-signatures/src/generators/git_flow.rs @@ -0,0 +1,9 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("git-flow").add_generator( + "type_branches", + Generator::command_from_tokens(fig_token::git_flow_type_branches, output_parsers::lines), + ) +} diff --git a/command-signatures/src/generators/iex.rs b/command-signatures/src/generators/iex.rs new file mode 100644 index 00000000..b5f193d3 --- /dev/null +++ b/command-signatures/src/generators/iex.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("iex").add_filter("filter-exs", template_filters::exs()) +} diff --git a/command-signatures/src/generators/java.rs b/command-signatures/src/generators/java.rs new file mode 100644 index 00000000..0ec9b6dd --- /dev/null +++ b/command-signatures/src/generators/java.rs @@ -0,0 +1,8 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("java") + .add_filter("filter-java-class", template_filters::java_class()) + .add_filter("filter-jar", template_filters::jar()) +} diff --git a/command-signatures/src/generators/julia.rs b/command-signatures/src/generators/julia.rs new file mode 100644 index 00000000..734b83a4 --- /dev/null +++ b/command-signatures/src/generators/julia.rs @@ -0,0 +1,8 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("julia") + .add_filter("filter-jl", template_filters::jl()) + .add_filter("filter-dylib-so-dll", template_filters::dylib_so_dll()) +} diff --git a/command-signatures/src/generators/man.rs b/command-signatures/src/generators/man.rs index 00238984..420b15fa 100644 --- a/command-signatures/src/generators/man.rs +++ b/command-signatures/src/generators/man.rs @@ -3,46 +3,54 @@ use warp_completion_metadata::{ }; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("man").add_generator( - "list_man_pages", - Generator::command_from_tokens( - |tokens, _, _| { - let section_glob = match tokens.last() { - Some(maybe_section) - if maybe_section.len() == 1 - && *maybe_section >= "1" - && *maybe_section <= "8" => - { - maybe_section - } - // On a high-level, this code is try to get man completions for type 1 (general commands) and 8 (system admin and daemons) packages. - // man -w gives the all directories that contain man pages. These directories are further broken into sub-directories categorized by the type number. - // For example, a general command will live in man1 package and a system command will live in man8. - // What this command is doing is to chain all the different directories that have man pages and run ls to get all the page names. The [] operator in ls - // gives all possible values to match on. For example, ls man[18] will run ls man1 and ls man8 and chain together the output - _ => "[18]", - }; - CommandBuilder::pipe( - CommandBuilder::single_command(format!( - "ls -1 $(man -w | sed 's#:#/man{} #g')", - section_glob - )), + CommandSignatureGenerators::new("man") + .add_generator( + "sections_remaining", + Generator::command_from_tokens( + super::fig_token::man_sections_remaining, + super::output_parsers::lines, + ), + ) + .add_generator( + "list_man_pages", + Generator::command_from_tokens( + |tokens, _, _| { + let section_glob = match tokens.last() { + Some(maybe_section) + if maybe_section.len() == 1 + && *maybe_section >= "1" + && *maybe_section <= "8" => + { + maybe_section + } + // On a high-level, this code is try to get man completions for type 1 (general commands) and 8 (system admin and daemons) packages. + // man -w gives the all directories that contain man pages. These directories are further broken into sub-directories categorized by the type number. + // For example, a general command will live in man1 package and a system command will live in man8. + // What this command is doing is to chain all the different directories that have man pages and run ls to get all the page names. The [] operator in ls + // gives all possible values to match on. For example, ls man[18] will run ls man1 and ls man8 and chain together the output + _ => "[18]", + }; CommandBuilder::pipe( + CommandBuilder::single_command(format!( + "ls -1 $(man -w | sed 's#:#/man{} #g')", + section_glob + )), CommandBuilder::pipe( - CommandBuilder::single_command("cut -f 1 -d ."), - CommandBuilder::single_command("sort"), + CommandBuilder::pipe( + CommandBuilder::single_command("cut -f 1 -d ."), + CommandBuilder::single_command("sort"), + ), + CommandBuilder::single_command("uniq"), ), - CommandBuilder::single_command("uniq"), - ), - ) - }, - |output| { - output - .split('\n') - .filter(|&line| !line.is_empty() && !line.starts_with('/')) - .map(|line| Suggestion::with_description(line.trim(), "Man page")) - .collect_ordered_results() - }, - ), - ) + ) + }, + |output| { + output + .split('\n') + .filter(|&line| !line.is_empty() && !line.starts_with('/')) + .map(|line| Suggestion::with_description(line.trim(), "Man page")) + .collect_ordered_results() + }, + ), + ) } diff --git a/command-signatures/src/generators/meteor.rs b/command-signatures/src/generators/meteor.rs index 5eeb8365..cb13ee74 100644 --- a/command-signatures/src/generators/meteor.rs +++ b/command-signatures/src/generators/meteor.rs @@ -1,4 +1,4 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -24,4 +24,5 @@ pub fn generator() -> CommandSignatureGenerators { output_parsers::lines, ), ) + .add_filter("filter-json", template_filters::json()) } diff --git a/command-signatures/src/generators/mix.rs b/command-signatures/src/generators/mix.rs index 50ef63e1..a90b6337 100644 --- a/command-signatures/src/generators/mix.rs +++ b/command-signatures/src/generators/mix.rs @@ -1,12 +1,14 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("mix").add_generator( - "help", - Generator::script( - CommandBuilder::single_command("mix help"), - output_parsers::lines, - ), - ) + CommandSignatureGenerators::new("mix") + .add_generator( + "help", + Generator::script( + CommandBuilder::single_command("mix help"), + output_parsers::lines, + ), + ) + .add_filter("filter-exs", template_filters::exs()) } diff --git a/command-signatures/src/generators/mod.rs b/command-signatures/src/generators/mod.rs index bf2f54a5..af86a2bb 100644 --- a/command-signatures/src/generators/mod.rs +++ b/command-signatures/src/generators/mod.rs @@ -11,35 +11,45 @@ mod bat; mod black; mod checkov; mod chown; +mod cloudflared; mod cmd_n; mod common; mod copilot; mod cordova; +mod dd; +mod degit; mod deno; mod deployctl; mod deta; mod direnv; mod dtm; mod eb; +mod elixir; mod elm; mod elm_review; +mod esbuild; mod eslint; mod expo; mod expo_cli; mod ffmpeg; mod fig_teams; mod fig_token; +mod file; mod fisher; mod fly; mod flyctl; mod fnm; mod fvm; +mod git_flow; mod gpg; mod hexo; mod hugo; mod hyper; mod id; +mod iex; mod ignite_cli; +mod java; +mod julia; mod kool; mod lerna; mod limactl; @@ -49,14 +59,19 @@ mod meteor; mod mix; mod mosh; mod networkquality; +mod ni; mod npx; mod nr; mod ns; mod okteto; mod op; mod open; +mod osascript; mod output_parsers; mod pandoc; +mod pdfunite; +mod pm2; +mod pod; mod pre_commit; mod projj; mod python; @@ -66,6 +81,8 @@ mod rancher; mod rclone; mod redwood; mod robot; +mod rollup; +mod rscript; mod rush; mod rushx; mod rustup; @@ -73,7 +90,10 @@ mod scc; mod sftp; mod shortcuts; mod softwareupdate; +mod sqlite3; +mod st2; mod stepzen; +mod subl; mod sysctl; mod tailscale; mod tccutil; @@ -85,14 +105,17 @@ mod tokei; mod trex; mod trivy; mod ts_node; +mod tsc; mod turbo; mod vite; mod vr; mod vsce; mod vultr_cli; +mod wasm_bindgen; mod watson; mod wd; mod wifi_password; +mod xcodeproj; mod yo; mod youtube_dl; @@ -209,6 +232,7 @@ pub fn dynamic_command_signature_data() -> HashMap HashMap HashMap CommandSignatureGenerators { + CommandSignatureGenerators::new("ni").add_generator( + "npms_search", + Generator::command_from_tokens(fig_token::npms_search, output_parsers::npms_search_results), + ) +} diff --git a/command-signatures/src/generators/npm.rs b/command-signatures/src/generators/npm.rs index 27670526..a3468ce3 100644 --- a/command-signatures/src/generators/npm.rs +++ b/command-signatures/src/generators/npm.rs @@ -269,6 +269,13 @@ pub fn npm_generators() -> CommandSignatureGenerators { .add_generator("workspace_generator", workspace_generator()) .add_generator("npm_registry_search", npm_registry_search_generator()) .add_alias("script_alias", script_alias_generator()) + .add_generator( + "npms_search", + Generator::command_from_tokens( + super::fig_token::npms_search, + output_parsers::npms_search_results, + ), + ) } fn workspace_packages_generator() -> Generator { @@ -330,6 +337,13 @@ pub fn pnpm_generators() -> CommandSignatureGenerators { output_parsers::json_script_keys, ), ) + .add_generator( + "npms_search", + Generator::command_from_tokens( + super::fig_token::npms_search, + output_parsers::npms_search_results, + ), + ) } pub fn yarn_generators() -> CommandSignatureGenerators { @@ -389,6 +403,13 @@ pub fn yarn_generators() -> CommandSignatureGenerators { super::output_parsers::npms_search_results, ), ) + .add_generator( + "npms_search", + Generator::command_from_tokens( + super::fig_token::npms_search, + super::output_parsers::npms_search_results, + ), + ) } #[cfg(test)] diff --git a/command-signatures/src/generators/osascript.rs b/command-signatures/src/generators/osascript.rs new file mode 100644 index 00000000..4e79235b --- /dev/null +++ b/command-signatures/src/generators/osascript.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("osascript").add_filter("filter-scpt", template_filters::scpt()) +} diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index e210f3b5..14fb41b8 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -282,6 +282,97 @@ pub fn gh_repo_list_json(output: &str) -> GeneratorResults { } } +pub fn github_repos_json(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let name = value.get("full_name")?.as_str()?; + let description = value + .get("description") + .and_then(Value::as_str) + .unwrap_or("Repository"); + Some(Suggestion::with_description(name, description)) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn robot_variables(output: &str) -> GeneratorResults { + let mut seen = std::collections::HashSet::new(); + nonempty_lines(output) + .filter_map(|line| { + let start = line.find("${")?; + let rest = &line[start + 2..]; + let end = rest.find('}')?; + let name = rest[..end].trim(); + (!name.is_empty() && seen.insert(name.to_string())) + .then(|| Suggestion::with_description(name, "Variable")) + }) + .collect_unordered_results() +} + +pub fn robot_test_cases(output: &str) -> GeneratorResults { + let mut seen = std::collections::HashSet::new(); + let mut in_tests = false; + output + .lines() + .filter_map(|line| { + let trimmed = line.trim(); + if trimmed.eq_ignore_ascii_case("*** Test Cases ***") + || trimmed.eq_ignore_ascii_case("***Test Cases***") + { + in_tests = true; + return None; + } + if in_tests && trimmed.starts_with("***") { + in_tests = false; + return None; + } + if !in_tests || line.starts_with(' ') || line.starts_with('\t') || trimmed.is_empty() { + return None; + } + let name = trimmed.split('#').next().unwrap_or(trimmed).trim(); + if name.is_empty() || name.contains(" ") { + return None; + } + seen.insert(name.to_string()) + .then(|| Suggestion::with_description(name, "Test case")) + }) + .collect_unordered_results() +} + +pub fn robot_tags(output: &str) -> GeneratorResults { + let mut seen = std::collections::HashSet::new(); + nonempty_lines(output) + .filter_map(|line| { + let trimmed = line.trim_start(); + trimmed.strip_prefix("[Tags]") + }) + .flat_map(|rest| { + rest.split(" ") + .map(str::trim) + .filter(|tag| !tag.is_empty() && !tag.starts_with('#')) + .map(str::to_string) + .collect::>() + }) + .filter_map(|tag| { + seen.insert(tag.clone()) + .then(|| Suggestion::with_description(tag, "Tag")) + }) + .collect_unordered_results() +} + +pub fn scc_languages(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter_map(|line| { + let (name, _) = line.rsplit_once(" (")?; + Some(Suggestion::new(name.trim())) + }) + .collect_unordered_results() +} + pub fn docker_from_as_names(output: &str) -> GeneratorResults { let re = regex::Regex::new(r"(?i)(?:as)\s+([\w:.-]+)").ok(); nonempty_lines(output) diff --git a/command-signatures/src/generators/pandoc.rs b/command-signatures/src/generators/pandoc.rs index 068e15b0..987c8307 100644 --- a/command-signatures/src/generators/pandoc.rs +++ b/command-signatures/src/generators/pandoc.rs @@ -1,4 +1,4 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -26,4 +26,6 @@ pub fn generator() -> CommandSignatureGenerators { output_parsers::lines, ), ) + .add_filter("filter-yaml", template_filters::yaml()) + .add_filter("filter-yaml-json", template_filters::yaml_json()) } diff --git a/command-signatures/src/generators/pdfunite.rs b/command-signatures/src/generators/pdfunite.rs new file mode 100644 index 00000000..6b09aba2 --- /dev/null +++ b/command-signatures/src/generators/pdfunite.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("pdfunite").add_filter("filter-pdf", template_filters::pdf()) +} diff --git a/command-signatures/src/generators/pm2.rs b/command-signatures/src/generators/pm2.rs new file mode 100644 index 00000000..8abe748a --- /dev/null +++ b/command-signatures/src/generators/pm2.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("pm2").add_filter("filter-json", template_filters::json()) +} diff --git a/command-signatures/src/generators/pod.rs b/command-signatures/src/generators/pod.rs new file mode 100644 index 00000000..290f93ef --- /dev/null +++ b/command-signatures/src/generators/pod.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("pod").add_filter("filter-podspec", template_filters::podspec()) +} diff --git a/command-signatures/src/generators/r.rs b/command-signatures/src/generators/r.rs index fefcdafc..4662817e 100644 --- a/command-signatures/src/generators/r.rs +++ b/command-signatures/src/generators/r.rs @@ -1,12 +1,17 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("r").add_generator( - "rscript_libpaths", - Generator::script( - CommandBuilder::single_command("Rscript -e '.libPaths()'"), - output_parsers::lines, - ), - ) + CommandSignatureGenerators::new("r") + .add_generator( + "rscript_libpaths", + Generator::script( + CommandBuilder::single_command("Rscript -e '.libPaths()'"), + output_parsers::lines, + ), + ) + .add_filter("filter-r", template_filters::r()) + .add_filter("filter-rd", template_filters::rd()) + .add_filter("filter-r-src", template_filters::r_src()) + .add_filter("filter-r-archive", template_filters::r_archive()) } diff --git a/command-signatures/src/generators/rancher.rs b/command-signatures/src/generators/rancher.rs index c7486444..2609db9b 100644 --- a/command-signatures/src/generators/rancher.rs +++ b/command-signatures/src/generators/rancher.rs @@ -1,12 +1,14 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("rancher").add_generator( - "server", - Generator::script( - CommandBuilder::single_command("rancher server ls"), - output_parsers::lines, - ), - ) + CommandSignatureGenerators::new("rancher") + .add_generator( + "server", + Generator::script( + CommandBuilder::single_command("rancher server ls"), + output_parsers::lines, + ), + ) + .add_filter("filter-json-yaml", template_filters::json_yaml()) } diff --git a/command-signatures/src/generators/robot.rs b/command-signatures/src/generators/robot.rs index 62a3889d..2b88db06 100644 --- a/command-signatures/src/generators/robot.rs +++ b/command-signatures/src/generators/robot.rs @@ -1,14 +1,35 @@ -use super::output_parsers; +use super::{fig_token, output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("robot").add_generator( - "for_i_in_robot", - Generator::script( - CommandBuilder::single_command( - r#"for i in $(find -E . -regex ".*.robot" -type f); do cat -s $i ; done"#, + CommandSignatureGenerators::new("robot") + .add_generator( + "for_i_in_robot", + Generator::script( + CommandBuilder::single_command( + r#"for i in $(find -E . -regex ".*.robot" -type f); do cat -s $i ; done"#, + ), + output_parsers::robot_tags, ), - output_parsers::lines, - ), - ) + ) + .add_generator( + "test_cases", + Generator::script( + CommandBuilder::single_command( + r#"for i in $(find -E . -regex ".*.robot" -type f); do cat -s $i ; done"#, + ), + output_parsers::robot_test_cases, + ), + ) + .add_generator( + "variables", + Generator::command_from_tokens( + fig_token::robot_variables, + output_parsers::robot_variables, + ), + ) + .add_filter("filter-robot", template_filters::robot()) + .add_filter("filter-xml", template_filters::xml()) + .add_filter("filter-py-yaml", template_filters::py_yaml()) + .add_filter("filter-zip", template_filters::zip()) } diff --git a/command-signatures/src/generators/rollup.rs b/command-signatures/src/generators/rollup.rs new file mode 100644 index 00000000..87a8b58b --- /dev/null +++ b/command-signatures/src/generators/rollup.rs @@ -0,0 +1,7 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("rollup") + .add_filter("filter-config-js", template_filters::config_js()) +} diff --git a/command-signatures/src/generators/rscript.rs b/command-signatures/src/generators/rscript.rs new file mode 100644 index 00000000..b451fd1d --- /dev/null +++ b/command-signatures/src/generators/rscript.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("rscript").add_filter("filter-r", template_filters::r()) +} diff --git a/command-signatures/src/generators/rush.rs b/command-signatures/src/generators/rush.rs index 1e9cb018..fbb578e6 100644 --- a/command-signatures/src/generators/rush.rs +++ b/command-signatures/src/generators/rush.rs @@ -2,13 +2,21 @@ use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("rush").add_generator( - "until_rush_json_do_cd", - Generator::script( - CommandBuilder::single_command( - "until [[ -f rush.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat rush.json", + CommandSignatureGenerators::new("rush") + .add_generator( + "until_rush_json_do_cd", + Generator::script( + CommandBuilder::single_command( + "until [[ -f rush.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat rush.json", + ), + output_parsers::json_rush_projects, ), - output_parsers::json_rush_projects, - ), - ) + ) + .add_generator( + "npms_search", + Generator::command_from_tokens( + super::fig_token::npms_search, + output_parsers::npms_search_results, + ), + ) } diff --git a/command-signatures/src/generators/scc.rs b/command-signatures/src/generators/scc.rs index f520813d..20abda5b 100644 --- a/command-signatures/src/generators/scc.rs +++ b/command-signatures/src/generators/scc.rs @@ -1,12 +1,17 @@ -use super::output_parsers; +use super::{fig_token, output_parsers}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("scc").add_generator( - "completions", - Generator::script( - CommandBuilder::single_command("scc --languages"), - output_parsers::lines, - ), - ) + CommandSignatureGenerators::new("scc") + .add_generator( + "completions", + Generator::script( + CommandBuilder::single_command("scc --languages"), + output_parsers::scc_languages, + ), + ) + .add_generator( + "format_multi", + Generator::command_from_tokens(fig_token::scc_output_paths, output_parsers::lines), + ) } diff --git a/command-signatures/src/generators/shortcuts.rs b/command-signatures/src/generators/shortcuts.rs index 2de9e842..7888d851 100644 --- a/command-signatures/src/generators/shortcuts.rs +++ b/command-signatures/src/generators/shortcuts.rs @@ -1,4 +1,4 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -17,4 +17,5 @@ pub fn generator() -> CommandSignatureGenerators { output_parsers::lines, ), ) + .add_filter("filter-shortcut", template_filters::shortcut()) } diff --git a/command-signatures/src/generators/sqlite3.rs b/command-signatures/src/generators/sqlite3.rs new file mode 100644 index 00000000..6290e16c --- /dev/null +++ b/command-signatures/src/generators/sqlite3.rs @@ -0,0 +1,7 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("sqlite3") + .add_filter("filter-sqlite", template_filters::sqlite()) +} diff --git a/command-signatures/src/generators/st2.rs b/command-signatures/src/generators/st2.rs new file mode 100644 index 00000000..8da08e98 --- /dev/null +++ b/command-signatures/src/generators/st2.rs @@ -0,0 +1,9 @@ +use super::{fig_token, output_parsers}; +use warp_completion_metadata::{CommandSignatureGenerators, Generator}; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("st2").add_generator( + "users_or_groups", + Generator::command_from_tokens(fig_token::chown_dscl, output_parsers::lines), + ) +} diff --git a/command-signatures/src/generators/subl.rs b/command-signatures/src/generators/subl.rs new file mode 100644 index 00000000..f1bdb764 --- /dev/null +++ b/command-signatures/src/generators/subl.rs @@ -0,0 +1,7 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("subl") + .add_filter("filter-sublime", template_filters::sublime()) +} diff --git a/command-signatures/src/generators/template_filters.rs b/command-signatures/src/generators/template_filters.rs index bff628fa..c218dc07 100644 --- a/command-signatures/src/generators/template_filters.rs +++ b/command-signatures/src/generators/template_filters.rs @@ -3,11 +3,13 @@ use warp_completion_metadata::{ }; pub fn py() -> TemplateFilter { - TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["py"])) + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["py"], Some(76))) } pub fn yml_yaml() -> TemplateFilter { - TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["yml", "yaml"])) + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["yml", "yaml"], None) + }) } pub fn envrc() -> TemplateFilter { @@ -41,7 +43,6 @@ pub fn tsconfig_json() -> TemplateFilter { }) } -#[allow(dead_code)] pub fn xcodeproj() -> TemplateFilter { TemplateFilter(|mut suggestion, _path_type| { if suggestion.exact_string.ends_with(".xcodeproj/") @@ -53,17 +54,309 @@ pub fn xcodeproj() -> TemplateFilter { }) } +pub fn rs() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["rs"], None)) +} + +pub fn snap() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["snap"], None)) +} + +pub fn cargo_toml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_equals(suggestion, path_type, &["Cargo.toml"]) + }) +} + +pub fn cargo_lock() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_equals(suggestion, path_type, &["Cargo.lock"]) + }) +} + +pub fn rustfmt_toml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_equals(suggestion, path_type, &["rustfmt.toml"]) + }) +} + +pub fn deny_toml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_equals(suggestion, path_type, &["deny.toml"])) +} + +pub fn js_ts_family() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext( + suggestion, + path_type, + &["ts", "tsx", "js", "jsx", "mjs", "cjs"], + None, + ) + }) +} + +pub fn bun_script() -> TemplateFilter { + TemplateFilter(|mut suggestion, path_type| { + if path_type.is_folder() { + return Some(suggestion); + } + let name = suggestion.exact_string.to_ascii_lowercase(); + let matched = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs", ".mts", ".cts"] + .iter() + .any(|ext| name.ends_with(ext) || name.ends_with(&format!("{ext}/"))); + if matched { + suggestion.priority = Priority::Global(Importance::More(Order(76))); + Some(suggestion) + } else { + None + } + }) +} + +pub fn deployctl() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext( + suggestion, + path_type, + &["js", "mjs", "jsx", "mjsx", "ts", "mts", "tsx", "mtsx"], + None, + ) + }) +} + +pub fn exs() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["exs"], Some(76)) + }) +} + +pub fn java_class() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["java", "class"], None) + }) +} + +pub fn jar() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["jar"], None)) +} + +pub fn jl() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["jl"], Some(76))) +} + +pub fn dylib_so_dll() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["dylib", "so", "dll"], Some(76)) + }) +} + +pub fn json() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["json"], None)) +} + +pub fn yaml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["yaml"], None)) +} + +pub fn yaml_json() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["yaml", "json"], None) + }) +} + +pub fn json_yaml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["json", "yaml"], None) + }) +} + +pub fn scpt() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["scpt", "scptd"], Some(76)) + }) +} + +pub fn pdf() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["pdf"], None)) +} + +pub fn robot() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["robot"], Some(76)) + }) +} + +pub fn xml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["xml"], None)) +} + +pub fn py_yaml() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["py", "yaml"], None) + }) +} + +pub fn zip() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["zip"], None)) +} + +pub fn config_js() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + if path_type.is_folder() { + return Some(suggestion); + } + suggestion + .exact_string + .ends_with("config.js") + .then_some(suggestion) + }) +} + +pub fn r_src() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext( + suggestion, + path_type, + &["c", "cc", "cpp", "m", "mm", "M", "f", "f90", "f95"], + None, + ) + }) +} + +pub fn r_archive() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + if path_type.is_folder() { + return Some(suggestion); + } + let name = suggestion.exact_string.to_ascii_lowercase(); + ["tar", "tar.gz", "tzr.bz2", "tar.xz", "tgz"] + .iter() + .any(|ext| name.ends_with(&format!(".{ext}")) || name.ends_with(&format!(".{ext}/"))) + .then_some(suggestion) + }) +} + +pub fn rd() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["rd"], Some(76))) +} + +pub fn r() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["r"], Some(76))) +} + +pub fn shortcut() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["shortcut"], None) + }) +} + +pub fn sqlite() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext( + suggestion, + path_type, + &["sql", "sqlite", "sqlite3", "db"], + None, + ) + }) +} + +pub fn sublime() -> TemplateFilter { + TemplateFilter(|mut suggestion, path_type| { + if path_type.is_folder() { + return Some(suggestion); + } + let name = suggestion.exact_string.as_str(); + let matched = name.ends_with(".sublime-project") + || name.ends_with(".sublime-workspace") + || name.ends_with(".sublime-project/") + || name.ends_with(".sublime-workspace/"); + if matched { + suggestion.priority = Priority::Global(Importance::More(Order(76))); + Some(suggestion) + } else { + None + } + }) +} + +pub fn ts() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["ts"], Some(76))) +} + +pub fn ts_tsx() -> TemplateFilter { + TemplateFilter(|mut suggestion, path_type| { + if path_type.is_folder() { + return Some(suggestion); + } + let name = suggestion.exact_string.to_ascii_lowercase(); + let matched = name.ends_with(".ts") + || name.ends_with(".tsx") + || name.ends_with(".ts/") + || name.ends_with(".tsx/"); + if matched { + suggestion.priority = Priority::Global(Importance::More(Order(76))); + Some(suggestion) + } else { + None + } + }) +} + +pub fn vsix() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["vsix"], None)) +} + +pub fn wasm() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["wasm"], None)) +} + +pub fn podspec() -> TemplateFilter { + TemplateFilter(|suggestion, path_type| { + folders_or_ext(suggestion, path_type, &["podspec"], None) + }) +} + fn folders_or_ext( - suggestion: Suggestion, + mut suggestion: Suggestion, path_type: PathSuggestionType, extensions: &[&str], + file_priority: Option, ) -> Option { if path_type.is_folder() { return Some(suggestion); } let name = suggestion.exact_string.to_ascii_lowercase(); - extensions + let matched = extensions.iter().any(|ext| { + let ext = ext.to_ascii_lowercase(); + name.ends_with(&format!(".{ext}")) || name.ends_with(&format!(".{ext}/")) + }); + if matched { + if let Some(priority) = file_priority { + suggestion.priority = Priority::Global(Importance::More(Order(priority))); + } + Some(suggestion) + } else { + None + } +} + +fn folders_or_equals( + suggestion: Suggestion, + path_type: PathSuggestionType, + names: &[&str], +) -> Option { + if path_type.is_folder() { + return Some(suggestion); + } + let value = suggestion.exact_string.as_str(); + names .iter() - .any(|ext| name.ends_with(&format!(".{ext}")) || name.ends_with(&format!(".{ext}/"))) + .any(|name| { + value == *name + || value.ends_with(&format!("/{name}")) + || value.ends_with(&format!("{name}/")) + || value.ends_with(name) + }) .then_some(suggestion) } diff --git a/command-signatures/src/generators/ts_node.rs b/command-signatures/src/generators/ts_node.rs index f4aaa597..abdfe8a0 100644 --- a/command-signatures/src/generators/ts_node.rs +++ b/command-signatures/src/generators/ts_node.rs @@ -4,4 +4,5 @@ use warp_completion_metadata::CommandSignatureGenerators; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("ts-node") .add_filter("filter-tsconfig", template_filters::tsconfig_json()) + .add_filter("filter-ts-tsx", template_filters::ts_tsx()) } diff --git a/command-signatures/src/generators/tsc.rs b/command-signatures/src/generators/tsc.rs new file mode 100644 index 00000000..33b32094 --- /dev/null +++ b/command-signatures/src/generators/tsc.rs @@ -0,0 +1,6 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("tsc").add_filter("filter-ts", template_filters::ts()) +} diff --git a/command-signatures/src/generators/vsce.rs b/command-signatures/src/generators/vsce.rs index 5a589ad6..c55cadf0 100644 --- a/command-signatures/src/generators/vsce.rs +++ b/command-signatures/src/generators/vsce.rs @@ -1,14 +1,16 @@ -use super::output_parsers; +use super::{output_parsers, template_filters}; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("vsce").add_generator( - "git_branch", - Generator::script( - CommandBuilder::single_command( - "git --no-optional-locks branch -a --no-color --sort=-committerdate", + CommandSignatureGenerators::new("vsce") + .add_generator( + "git_branch", + Generator::script( + CommandBuilder::single_command( + "git --no-optional-locks branch -a --no-color --sort=-committerdate", + ), + output_parsers::lines, ), - output_parsers::lines, - ), - ) + ) + .add_filter("filter-vsix", template_filters::vsix()) } diff --git a/command-signatures/src/generators/wasm_bindgen.rs b/command-signatures/src/generators/wasm_bindgen.rs new file mode 100644 index 00000000..d5d433c0 --- /dev/null +++ b/command-signatures/src/generators/wasm_bindgen.rs @@ -0,0 +1,7 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("wasm-bindgen") + .add_filter("filter-wasm", template_filters::wasm()) +} diff --git a/command-signatures/src/generators/xcodeproj.rs b/command-signatures/src/generators/xcodeproj.rs new file mode 100644 index 00000000..8af28095 --- /dev/null +++ b/command-signatures/src/generators/xcodeproj.rs @@ -0,0 +1,7 @@ +use super::template_filters; +use warp_completion_metadata::CommandSignatureGenerators; + +pub fn generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("xcodeproj") + .add_filter("filter-xcodeproj", template_filters::xcodeproj()) +} From d1c75c6cb353a8b34e776117e729b4846937b44d Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 19:27:13 +0000 Subject: [PATCH 05/20] Parse remaining Fig JSON generators as objects, not lines Replace line-split callbacks for ansible-doc, tailscale peers, 1Password accounts, projj cache/hooks, trex imports/scripts, turbo pipeline, cargo read-manifest bins, and elm package search with the original object-specific postProcess mappings. --- command-signatures/json/tailscale.json | 2 +- .../src/generators/ansible_doc.rs | 2 +- command-signatures/src/generators/cargo.rs | 2 +- command-signatures/src/generators/elm.rs | 2 +- command-signatures/src/generators/lerna.rs | 2 +- command-signatures/src/generators/op.rs | 2 +- .../src/generators/output_parsers.rs | 195 ++++++++++++++++++ command-signatures/src/generators/projj.rs | 4 +- .../src/generators/tailscale.rs | 22 +- command-signatures/src/generators/trex.rs | 4 +- command-signatures/src/generators/turbo.rs | 4 +- command-signatures/src/generators/vsce.rs | 4 +- 12 files changed, 224 insertions(+), 21 deletions(-) diff --git a/command-signatures/json/tailscale.json b/command-signatures/json/tailscale.json index 1a77f17f..97cfddfb 100644 --- a/command-signatures/json/tailscale.json +++ b/command-signatures/json/tailscale.json @@ -343,7 +343,7 @@ "name": "file or host", "isVariadic": true, "template": "filepaths", - "generatorName": "status" + "generatorName": "peers_colon" } ] }, diff --git a/command-signatures/src/generators/ansible_doc.rs b/command-signatures/src/generators/ansible_doc.rs index 4a82ef33..d2ea4f19 100644 --- a/command-signatures/src/generators/ansible_doc.rs +++ b/command-signatures/src/generators/ansible_doc.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("ansible-doc --list --json 2>/dev/null"), - output_parsers::lines, + output_parsers::json_object_key_descriptions, ), ) } diff --git a/command-signatures/src/generators/cargo.rs b/command-signatures/src/generators/cargo.rs index 7780a5c6..caa82f5e 100644 --- a/command-signatures/src/generators/cargo.rs +++ b/command-signatures/src/generators/cargo.rs @@ -157,7 +157,7 @@ pub fn generator() -> CommandSignatureGenerators { "read_manifest", Generator::script( CommandBuilder::single_command("cargo read-manifest"), - output_parsers::json_string_array, + output_parsers::cargo_read_manifest_bins, ), ) .add_generator( diff --git a/command-signatures/src/generators/elm.rs b/command-signatures/src/generators/elm.rs index 879c0d5d..f12ab59f 100644 --- a/command-signatures/src/generators/elm.rs +++ b/command-signatures/src/generators/elm.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "elm_packages", Generator::script( CommandBuilder::single_command("curl -sH 'accept-encoding: gzip' https://package.elm-lang.org/search.json | gunzip"), - output_parsers::lines, + output_parsers::json_name_summary, ), ) } diff --git a/command-signatures/src/generators/lerna.rs b/command-signatures/src/generators/lerna.rs index c8a18245..5dcbae7c 100644 --- a/command-signatures/src/generators/lerna.rs +++ b/command-signatures/src/generators/lerna.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "git_branch", Generator::script( CommandBuilder::single_command("git branch --no-color"), - output_parsers::lines, + crate::generators::git::post_process_branches, ), ) .add_generator( diff --git a/command-signatures/src/generators/op.rs b/command-signatures/src/generators/op.rs index 5313561a..874e01e7 100644 --- a/command-signatures/src/generators/op.rs +++ b/command-signatures/src/generators/op.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "account_list_json", Generator::script( CommandBuilder::single_command("op account list --format json"), - output_parsers::lines, + output_parsers::op_accounts, ), ) } diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index 14fb41b8..cf837f5b 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -45,6 +45,20 @@ pub fn json_envs(output: &str) -> GeneratorResults { } } +pub fn json_name_summary(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let name = value.get("name")?.as_str()?; + let description = value.get("summary").and_then(Value::as_str).unwrap_or(""); + Some(Suggestion::with_description(name, description)) + }) + .collect_unordered_results(), + _ => empty(), + } +} + pub fn json_string_array(output: &str) -> GeneratorResults { match json(output) { Some(Value::Array(arr)) => arr @@ -55,6 +69,168 @@ pub fn json_string_array(output: &str) -> GeneratorResults { } } +pub fn json_object_key_descriptions(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Object(map)) => map + .into_iter() + .map(|(name, value)| { + let description = match value { + Value::String(s) => s, + other => other.as_str().map(str::to_owned).unwrap_or_default(), + }; + Suggestion::with_description(name, description) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn tailscale_peers(output: &str) -> GeneratorResults { + tailscale_peers_with_suffix(output, "") +} + +pub fn tailscale_peers_colon(output: &str) -> GeneratorResults { + tailscale_peers_with_suffix(output, ":") +} + +pub fn op_accounts(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let email = value.get("email")?.as_str()?; + let url = value.get("url").and_then(Value::as_str).unwrap_or(""); + let uuid = value.get("account_uuid")?.as_str()?; + Some( + Suggestion::with_description(uuid, url) + .with_display_name(Some(email.to_string())), + ) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn projj_cache_repos(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Object(map)) => map + .into_iter() + .map(|(key, value)| { + let name = key.rsplit('/').next().unwrap_or(&key); + let description = value.get("repo").and_then(Value::as_str).unwrap_or(""); + Suggestion::with_description(name, description) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn projj_hooks(output: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("hooks").cloned()) { + Some(Value::Object(map)) => map + .into_iter() + .map(|(name, value)| { + let description = match value { + Value::String(s) => s, + other => other.to_string(), + }; + Suggestion::with_description(name, description) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn trex_imports(output: &str) -> GeneratorResults { + if output.trim().is_empty() { + return empty(); + } + match json(output).and_then(|v| v.get("imports").cloned()) { + Some(Value::Object(map)) => map + .into_iter() + .map(|(name, value)| { + let description = value.as_str().unwrap_or(""); + Suggestion::with_description(name, description) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn trex_scripts(output: &str) -> GeneratorResults { + if output.trim().is_empty() { + return empty(); + } + match json(output).and_then(|v| v.get("scripts").cloned()) { + Some(Value::Object(map)) => map + .into_iter() + .map(|(name, _)| Suggestion::with_description(name, "trex script")) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn turbo_pipeline(output: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("pipeline").cloned()) { + Some(Value::Object(map)) => map + .into_iter() + .map(|(name, value)| { + let mut parts = Vec::new(); + if let Some(Value::Array(depends)) = value.get("dependsOn") { + let items: Vec<_> = depends + .iter() + .filter_map(Value::as_str) + .map(|item| format!("'{item}'")) + .collect(); + if !items.is_empty() { + parts.push(format!("depends on {}", items.join(", "))); + } + } + if let Some(Value::Array(outputs)) = value.get("outputs") { + let items: Vec<_> = outputs + .iter() + .filter_map(Value::as_str) + .map(|item| format!("'{item}'")) + .collect(); + if !items.is_empty() { + parts.push(format!("outputs {}", items.join(", "))); + } + } + let description = if parts.is_empty() { + "Task".to_string() + } else { + format!("Task: {}", parts.join(", ")) + }; + Suggestion::with_description(name, description) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn cargo_read_manifest_bins(output: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("targets").cloned()) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|target| { + let is_bin = target + .get("kind") + .and_then(Value::as_array) + .is_some_and(|kind| kind.iter().any(|item| item.as_str() == Some("bin"))); + is_bin + .then(|| { + target + .get("name") + .and_then(Value::as_str) + .map(Suggestion::new) + }) + .flatten() + }) + .collect_unordered_results(), + _ => empty(), + } +} + pub fn json_cordova_platforms(output: &str) -> GeneratorResults { match json(output) .and_then(|v| v.get("cordova").cloned()) @@ -451,6 +627,25 @@ fn skip_header_first_token( .collect_unordered_results() } +fn tailscale_peers_with_suffix(output: &str, suffix: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("Peer").cloned()) { + Some(Value::Object(map)) => map + .into_values() + .filter_map(|peer| { + let dns = peer.get("DNSName")?.as_str()?; + let short = dns.split('.').next().unwrap_or(dns); + let host = peer.get("HostName").and_then(Value::as_str).unwrap_or(""); + let os = peer.get("OS").and_then(Value::as_str).unwrap_or(""); + Some( + Suggestion::with_description(format!("{short}{suffix}"), os) + .with_display_name(Some(host.to_string())), + ) + }) + .collect_unordered_results(), + _ => empty(), + } +} + fn json(output: &str) -> Option { serde_json::from_str(output.trim()).ok() } diff --git a/command-signatures/src/generators/projj.rs b/command-signatures/src/generators/projj.rs index f0dc6737..fcaa35ed 100644 --- a/command-signatures/src/generators/projj.rs +++ b/command-signatures/src/generators/projj.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "cat_projj_cache_json", Generator::script( CommandBuilder::single_command("cat ~/.projj/cache.json"), - output_parsers::lines, + output_parsers::projj_cache_repos, ), ) .add_generator( "cat_projj_config_json", Generator::script( CommandBuilder::single_command("cat ~/.projj/config.json"), - output_parsers::lines, + output_parsers::projj_hooks, ), ) } diff --git a/command-signatures/src/generators/tailscale.rs b/command-signatures/src/generators/tailscale.rs index 28f0e065..ad4321b3 100644 --- a/command-signatures/src/generators/tailscale.rs +++ b/command-signatures/src/generators/tailscale.rs @@ -2,11 +2,19 @@ use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("tailscale").add_generator( - "status", - Generator::script( - CommandBuilder::single_command("tailscale status --json"), - output_parsers::lines, - ), - ) + CommandSignatureGenerators::new("tailscale") + .add_generator( + "status", + Generator::script( + CommandBuilder::single_command("tailscale status --json"), + output_parsers::tailscale_peers, + ), + ) + .add_generator( + "peers_colon", + Generator::script( + CommandBuilder::single_command("tailscale status --json"), + output_parsers::tailscale_peers_colon, + ), + ) } diff --git a/command-signatures/src/generators/trex.rs b/command-signatures/src/generators/trex.rs index 9ad33651..4a5c23ba 100644 --- a/command-signatures/src/generators/trex.rs +++ b/command-signatures/src/generators/trex.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "cat_import_map_json", Generator::script( CommandBuilder::single_command("cat import_map.json"), - output_parsers::lines, + output_parsers::trex_imports, ), ) .add_generator( "cat_run_json", Generator::script( CommandBuilder::single_command("cat run.json"), - output_parsers::json_script_keys, + output_parsers::trex_scripts, ), ) } diff --git a/command-signatures/src/generators/turbo.rs b/command-signatures/src/generators/turbo.rs index 20466fd8..9990d3b3 100644 --- a/command-signatures/src/generators/turbo.rs +++ b/command-signatures/src/generators/turbo.rs @@ -9,7 +9,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch -a --no-color --sort=-committerdate", ), - output_parsers::lines, + crate::generators::git::post_process_branches, ), ) .add_generator( @@ -18,7 +18,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ ( -f turbo.json || $PWD = '/' ) ]]; do cd ..; done; cat turbo.json", ), - output_parsers::lines, + output_parsers::turbo_pipeline, ), ) } diff --git a/command-signatures/src/generators/vsce.rs b/command-signatures/src/generators/vsce.rs index c55cadf0..229d1237 100644 --- a/command-signatures/src/generators/vsce.rs +++ b/command-signatures/src/generators/vsce.rs @@ -1,4 +1,4 @@ -use super::{output_parsers, template_filters}; +use super::template_filters; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -9,7 +9,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch -a --no-color --sort=-committerdate", ), - output_parsers::lines, + crate::generators::git::post_process_branches, ), ) .add_filter("filter-vsix", template_filters::vsix()) From 04f2dacd448fccb90118a6b0568fb1b3c54063dd Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 19:46:25 +0000 Subject: [PATCH 06/20] Replace remaining Fig line-split parsers with original postProcess semantics Parse Docker search JSON-lines, StepZen schema/GitHub contents, youtube-dl playlist JSON, and Lerna package.json END streams. Map other non-name-only line registrations to description, git-branch, YAML hook-id, and related structured callbacks. --- command-signatures/src/generators/assimp.rs | 4 +- command-signatures/src/generators/autojump.rs | 2 +- command-signatures/src/generators/bat.rs | 14 +- command-signatures/src/generators/black.rs | 2 +- command-signatures/src/generators/cargo.rs | 2 +- command-signatures/src/generators/checkov.rs | 3 +- command-signatures/src/generators/cmd_n.rs | 2 +- command-signatures/src/generators/cordova.rs | 2 +- command-signatures/src/generators/deno.rs | 2 +- command-signatures/src/generators/deta.rs | 2 +- command-signatures/src/generators/docker.rs | 5 +- command-signatures/src/generators/dtm.rs | 2 +- .../src/generators/elm_review.rs | 2 +- command-signatures/src/generators/eslint.rs | 4 +- command-signatures/src/generators/fisher.rs | 2 +- command-signatures/src/generators/fvm.rs | 2 +- command-signatures/src/generators/gh.rs | 2 +- command-signatures/src/generators/git.rs | 10 +- command-signatures/src/generators/gpg.rs | 2 +- command-signatures/src/generators/hexo.rs | 2 +- command-signatures/src/generators/hugo.rs | 2 +- command-signatures/src/generators/hyper.rs | 2 +- command-signatures/src/generators/id.rs | 2 +- .../src/generators/ignite_cli.rs | 2 +- command-signatures/src/generators/kool.rs | 2 +- command-signatures/src/generators/lerna.rs | 6 +- command-signatures/src/generators/limactl.rs | 2 +- command-signatures/src/generators/mackup.rs | 2 +- command-signatures/src/generators/mdfind.rs | 2 +- command-signatures/src/generators/meteor.rs | 6 +- command-signatures/src/generators/mix.rs | 2 +- command-signatures/src/generators/mosh.rs | 2 +- .../src/generators/networkquality.rs | 2 +- command-signatures/src/generators/npx.rs | 2 +- command-signatures/src/generators/nx.rs | 2 +- command-signatures/src/generators/okteto.rs | 4 +- command-signatures/src/generators/open.rs | 4 +- .../src/generators/output_parsers.rs | 331 ++++++++++++++++-- command-signatures/src/generators/pandoc.rs | 6 +- .../src/generators/pre_commit.rs | 8 +- .../src/generators/quickmail.rs | 2 +- command-signatures/src/generators/r.rs | 2 +- command-signatures/src/generators/rancher.rs | 2 +- command-signatures/src/generators/rclone.rs | 2 +- command-signatures/src/generators/redwood.rs | 2 +- command-signatures/src/generators/sftp.rs | 2 +- .../src/generators/shortcuts.rs | 4 +- .../src/generators/softwareupdate.rs | 2 +- command-signatures/src/generators/stepzen.rs | 4 +- command-signatures/src/generators/sysctl.rs | 2 +- command-signatures/src/generators/tccutil.rs | 2 +- .../src/generators/terragrunt.rs | 4 +- command-signatures/src/generators/tfenv.rs | 4 +- command-signatures/src/generators/tfsec.rs | 2 +- .../src/generators/vultr_cli.rs | 2 +- command-signatures/src/generators/watson.rs | 4 +- command-signatures/src/generators/wd.rs | 2 +- .../src/generators/wifi_password.rs | 2 +- command-signatures/src/generators/yo.rs | 2 +- .../src/generators/youtube_dl.rs | 4 +- 60 files changed, 399 insertions(+), 112 deletions(-) diff --git a/command-signatures/src/generators/assimp.rs b/command-signatures/src/generators/assimp.rs index 8c02ef58..3252d7aa 100644 --- a/command-signatures/src/generators/assimp.rs +++ b/command-signatures/src/generators/assimp.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "listexport", Generator::script( CommandBuilder::single_command("assimp listexport"), - output_parsers::lines, + output_parsers::desc_extension, ), ) .add_generator( "listext", Generator::script( CommandBuilder::single_command("assimp listext"), - output_parsers::lines_desc_extension, + output_parsers::desc_extension, ), ) } diff --git a/command-signatures/src/generators/autojump.rs b/command-signatures/src/generators/autojump.rs index 56c9b37e..8416397d 100644 --- a/command-signatures/src/generators/autojump.rs +++ b/command-signatures/src/generators/autojump.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat", Generator::script( CommandBuilder::single_command(r#"cat "$HOME"/Library/autojump/autojump.txt"#), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/bat.rs b/command-signatures/src/generators/bat.rs index 124756d5..0296fd9b 100644 --- a/command-signatures/src/generators/bat.rs +++ b/command-signatures/src/generators/bat.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("bat --list-themes"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( "completions_bat", Generator::script( CommandBuilder::single_command("bat --list-languages"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( @@ -23,7 +23,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --paging unknow 2>&1 >/dev/null | grep possible", ), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( @@ -32,7 +32,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --decorations unknow 2>&1 >/dev/null | grep possible", ), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( @@ -41,7 +41,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --color unknow 2>&1 >/dev/null | grep possible", ), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( @@ -50,7 +50,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --italic-text unknow 2>&1 >/dev/null | grep possible", ), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( @@ -59,7 +59,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "bat --wrap unknow 2>&1 >/dev/null | grep possible", ), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/black.rs b/command-signatures/src/generators/black.rs index 7c2c57dd..b5061b3f 100644 --- a/command-signatures/src/generators/black.rs +++ b/command-signatures/src/generators/black.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "gh_release_list_psf_black", Generator::script( CommandBuilder::single_command("gh release list --repo psf/black"), - output_parsers::lines, + output_parsers::desc_version, ), ) } diff --git a/command-signatures/src/generators/cargo.rs b/command-signatures/src/generators/cargo.rs index caa82f5e..0b0af3ba 100644 --- a/command-signatures/src/generators/cargo.rs +++ b/command-signatures/src/generators/cargo.rs @@ -169,7 +169,7 @@ pub fn generator() -> CommandSignatureGenerators { ) .add_generator( "test_list", - Generator::command_from_tokens(fig_token::cargo_test_list, output_parsers::lines), + Generator::command_from_tokens(fig_token::cargo_test_list, output_parsers::named_lines), ) .add_filter("filter-cargo-toml", template_filters::cargo_toml()) .add_filter("filter-cargo-lock", template_filters::cargo_lock()) diff --git a/command-signatures/src/generators/checkov.rs b/command-signatures/src/generators/checkov.rs index cb380e39..7651f04a 100644 --- a/command-signatures/src/generators/checkov.rs +++ b/command-signatures/src/generators/checkov.rs @@ -1,4 +1,3 @@ -use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { @@ -6,7 +5,7 @@ pub fn generator() -> CommandSignatureGenerators { "git_branch", Generator::script( CommandBuilder::single_command("git branch --no-color"), - output_parsers::lines, + crate::generators::git::post_process_branches, ), ) } diff --git a/command-signatures/src/generators/cmd_n.rs b/command-signatures/src/generators/cmd_n.rs index e5edbe0e..8db711e3 100644 --- a/command-signatures/src/generators/cmd_n.rs +++ b/command-signatures/src/generators/cmd_n.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "lsr", Generator::script( CommandBuilder::single_command("n lsr --all"), - output_parsers::lines, + output_parsers::slice2_reversed, ), ) .add_filter("filter-js-ts-family", template_filters::js_ts_family()) diff --git a/command-signatures/src/generators/cordova.rs b/command-signatures/src/generators/cordova.rs index 0b954606..a49e7e61 100644 --- a/command-signatures/src/generators/cordova.rs +++ b/command-signatures/src/generators/cordova.rs @@ -14,7 +14,7 @@ pub fn generator() -> CommandSignatureGenerators { "plugin_list", Generator::script( CommandBuilder::single_command("cordova plugin list"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/deno.rs b/command-signatures/src/generators/deno.rs index d76ab493..b8494b61 100644 --- a/command-signatures/src/generators/deno.rs +++ b/command-signatures/src/generators/deno.rs @@ -16,7 +16,7 @@ pub fn generator() -> CommandSignatureGenerators { "deno_binaries", Generator::script( CommandBuilder::single_command(r"\find ~/.deno/bin -maxdepth 1 -perm -111 -type f"), - output_parsers::lines, + output_parsers::deno_binaries, ), ) .add_generator( diff --git a/command-signatures/src/generators/deta.rs b/command-signatures/src/generators/deta.rs index 83f82af3..0d32b58b 100644 --- a/command-signatures/src/generators/deta.rs +++ b/command-signatures/src/generators/deta.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "node12_node14_python3_7_python3", Generator::script( CommandBuilder::single_command("echo node12, node14, python3.7, python3.9"), - output_parsers::lines_desc_runtime, + output_parsers::desc_runtime, ), ) } diff --git a/command-signatures/src/generators/docker.rs b/command-signatures/src/generators/docker.rs index 75826b40..194c60cf 100644 --- a/command-signatures/src/generators/docker.rs +++ b/command-signatures/src/generators/docker.rs @@ -489,6 +489,9 @@ pub fn generator() -> CommandSignatureGenerators { ) .add_generator( "search", - Generator::command_from_tokens(super::fig_token::docker_search, super::output_parsers::lines), + Generator::command_from_tokens( + super::fig_token::docker_search, + super::output_parsers::docker_search_names, + ), ) } diff --git a/command-signatures/src/generators/dtm.rs b/command-signatures/src/generators/dtm.rs index e426da26..229980c7 100644 --- a/command-signatures/src/generators/dtm.rs +++ b/command-signatures/src/generators/dtm.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "list_plugins", Generator::script( CommandBuilder::single_command("dtm list plugins"), - output_parsers::lines, + output_parsers::desc_plugin, ), ) .add_filter("filter-yml-yaml", template_filters::yml_yaml()) diff --git a/command-signatures/src/generators/elm_review.rs b/command-signatures/src/generators/elm_review.rs index 3b3d7ffc..0d690c96 100644 --- a/command-signatures/src/generators/elm_review.rs +++ b/command-signatures/src/generators/elm_review.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "echo", Generator::script( CommandBuilder::single_command("echo"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/eslint.rs b/command-signatures/src/generators/eslint.rs index 8bd1b7a6..982ec3dd 100644 --- a/command-signatures/src/generators/eslint.rs +++ b/command-signatures/src/generators/eslint.rs @@ -7,11 +7,11 @@ pub fn generator() -> CommandSignatureGenerators { "ls_node_modules_root_global", Generator::script( CommandBuilder::single_command("{ ls node_modules ; ls $(npm root -g) ; ls $(yarn global dir)/node_modules/ ; } | cat"), - output_parsers::lines, + output_parsers::eslint_plugin_names, ), ) .add_generator( "env_remaining", - Generator::command_from_tokens(super::fig_token::eslint_env_remaining, output_parsers::lines), + Generator::command_from_tokens(super::fig_token::eslint_env_remaining, output_parsers::named_lines), ) } diff --git a/command-signatures/src/generators/fisher.rs b/command-signatures/src/generators/fisher.rs index d19b9b2a..d56a525d 100644 --- a/command-signatures/src/generators/fisher.rs +++ b/command-signatures/src/generators/fisher.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "fish_fisher_list", Generator::script( CommandBuilder::single_command("fish -c 'fisher list'"), - output_parsers::lines, + output_parsers::desc_plugin, ), ) } diff --git a/command-signatures/src/generators/fvm.rs b/command-signatures/src/generators/fvm.rs index 742e9c32..f7d804b6 100644 --- a/command-signatures/src/generators/fvm.rs +++ b/command-signatures/src/generators/fvm.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "releases", Generator::script( CommandBuilder::single_command("fvm releases"), - output_parsers::lines, + output_parsers::unique_named_lines, ), ) } diff --git a/command-signatures/src/generators/gh.rs b/command-signatures/src/generators/gh.rs index 57ed3a43..5aedc8bd 100644 --- a/command-signatures/src/generators/gh.rs +++ b/command-signatures/src/generators/gh.rs @@ -57,7 +57,7 @@ pub fn generator() -> CommandSignatureGenerators { "git_branch", Generator::script( CommandBuilder::single_command("git --no-optional-locks branch -r --no-color --sort=-committerdate"), - output_parsers::lines, + crate::generators::git::post_process_branches, ), ) .add_generator( diff --git a/command-signatures/src/generators/git.rs b/command-signatures/src/generators/git.rs index 869fb640..cea814a9 100644 --- a/command-signatures/src/generators/git.rs +++ b/command-signatures/src/generators/git.rs @@ -1033,14 +1033,14 @@ pub fn generator() -> CommandSignatureGenerators { "branches", Generator::script( CommandBuilder::single_command("git --no-optional-locks branch --no-color --sort=-committerdate"), - output_parsers::lines, + post_process_branches, ), ) .add_generator( "branches_no", Generator::script( CommandBuilder::single_command("git --no-optional-locks branch -a --no-color --sort=-committerdate"), - output_parsers::lines, + post_process_branches, ), ) .add_generator( @@ -1054,21 +1054,21 @@ pub fn generator() -> CommandSignatureGenerators { "status", Generator::script( CommandBuilder::single_command("git --no-optional-locks status --short"), - output_parsers::lines, + output_parsers::git_status_short, ), ) .add_generator( "tag", Generator::script( CommandBuilder::single_command("git --no-optional-locks tag --list --sort=-committerdate"), - output_parsers::lines, + post_process_tags, ), ) .add_generator( "status_staged_or_unstaged", Generator::command_from_tokens( super::fig_token::git_status_staged_or_unstaged, - output_parsers::lines, + output_parsers::git_oneline, ), ) } diff --git a/command-signatures/src/generators/gpg.rs b/command-signatures/src/generators/gpg.rs index ed1fc942..6e97dbd5 100644 --- a/command-signatures/src/generators/gpg.rs +++ b/command-signatures/src/generators/gpg.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("gpg --version"), - output_parsers::lines, + output_parsers::gpg_ciphers, ), ) } diff --git a/command-signatures/src/generators/hexo.rs b/command-signatures/src/generators/hexo.rs index 6a88acfe..642dd624 100644 --- a/command-signatures/src/generators/hexo.rs +++ b/command-signatures/src/generators/hexo.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list_post_draft", Generator::script( CommandBuilder::single_command("hexo list post | grep -E ^Draft"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/hugo.rs b/command-signatures/src/generators/hugo.rs index f70a1b54..02a418fa 100644 --- a/command-signatures/src/generators/hugo.rs +++ b/command-signatures/src/generators/hugo.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "ls_archetypes", Generator::script( CommandBuilder::single_command("ls ./archetypes/"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/hyper.rs b/command-signatures/src/generators/hyper.rs index 6edd4517..6b6613f9 100644 --- a/command-signatures/src/generators/hyper.rs +++ b/command-signatures/src/generators/hyper.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("hyper list"), - output_parsers::lines, + output_parsers::desc_plugin_name, ), ) } diff --git a/command-signatures/src/generators/id.rs b/command-signatures/src/generators/id.rs index f482c380..b6a02bbb 100644 --- a/command-signatures/src/generators/id.rs +++ b/command-signatures/src/generators/id.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "dscl_users", Generator::script( CommandBuilder::single_command("dscl . -list /Users | grep -v '^_'"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/ignite_cli.rs b/command-signatures/src/generators/ignite_cli.rs index 2559890c..1cf8c7dd 100644 --- a/command-signatures/src/generators/ignite_cli.rs +++ b/command-signatures/src/generators/ignite_cli.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "ls_ignite_templates", Generator::script( CommandBuilder::single_command("ls ignite/templates"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/kool.rs b/command-signatures/src/generators/kool.rs index b1281616..b1f57082 100644 --- a/command-signatures/src/generators/kool.rs +++ b/command-signatures/src/generators/kool.rs @@ -14,7 +14,7 @@ pub fn generator() -> CommandSignatureGenerators { "run", Generator::script( CommandBuilder::single_command("kool run --help"), - output_parsers::lines, + output_parsers::desc_script, ), ) } diff --git a/command-signatures/src/generators/lerna.rs b/command-signatures/src/generators/lerna.rs index 5dcbae7c..aabaa295 100644 --- a/command-signatures/src/generators/lerna.rs +++ b/command-signatures/src/generators/lerna.rs @@ -14,7 +14,7 @@ pub fn generator() -> CommandSignatureGenerators { "git_remote", Generator::script( CommandBuilder::single_command("git remote"), - output_parsers::lines, + output_parsers::desc_remote, ), ) .add_generator( @@ -23,14 +23,14 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( r"lerna list -p | while read p; do \cat $p/package.json && echo END done", ), - output_parsers::json_script_keys, + output_parsers::lerna_package_script_keys, ), ) .add_generator( "ls", Generator::script( CommandBuilder::single_command("lerna ls"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/limactl.rs b/command-signatures/src/generators/limactl.rs index b4ed4016..57af9434 100644 --- a/command-signatures/src/generators/limactl.rs +++ b/command-signatures/src/generators/limactl.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("limactl list --quiet"), - output_parsers::lines_desc_instance, + output_parsers::desc_instance, ), ) .add_filter("filter-yml-yaml", template_filters::yml_yaml()) diff --git a/command-signatures/src/generators/mackup.rs b/command-signatures/src/generators/mackup.rs index c4e761ae..dce798ad 100644 --- a/command-signatures/src/generators/mackup.rs +++ b/command-signatures/src/generators/mackup.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("mackup list"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/mdfind.rs b/command-signatures/src/generators/mdfind.rs index d85e3513..a8f2fd81 100644 --- a/command-signatures/src/generators/mdfind.rs +++ b/command-signatures/src/generators/mdfind.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "ls_library_saved_searches_savedsearch", Generator::script( CommandBuilder::single_command(r"ls -1A ~/Library/Saved\ Searches/*.savedSearch"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/meteor.rs b/command-signatures/src/generators/meteor.rs index cb13ee74..abae0080 100644 --- a/command-signatures/src/generators/meteor.rs +++ b/command-signatures/src/generators/meteor.rs @@ -7,21 +7,21 @@ pub fn generator() -> CommandSignatureGenerators { "cat_meteor_packages", Generator::script( CommandBuilder::single_command("cat ./.meteor/packages"), - output_parsers::lines, + output_parsers::meteor_packages, ), ) .add_generator( "create", Generator::script( CommandBuilder::single_command("meteor create --list"), - output_parsers::lines, + output_parsers::meteor_examples, ), ) .add_generator( "list_platforms", Generator::script( CommandBuilder::single_command("meteor list-platforms"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_filter("filter-json", template_filters::json()) diff --git a/command-signatures/src/generators/mix.rs b/command-signatures/src/generators/mix.rs index a90b6337..efc34375 100644 --- a/command-signatures/src/generators/mix.rs +++ b/command-signatures/src/generators/mix.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "help", Generator::script( CommandBuilder::single_command("mix help"), - output_parsers::lines, + output_parsers::mix_help_tasks, ), ) .add_filter("filter-exs", template_filters::exs()) diff --git a/command-signatures/src/generators/mosh.rs b/command-signatures/src/generators/mosh.rs index e5b61079..b21e3429 100644 --- a/command-signatures/src/generators/mosh.rs +++ b/command-signatures/src/generators/mosh.rs @@ -14,7 +14,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_ssh_known_hosts", Generator::script( CommandBuilder::single_command("cat ~/.ssh/known_hosts"), - output_parsers::lines, + output_parsers::ssh_hosts, ), ) } diff --git a/command-signatures/src/generators/networkquality.rs b/command-signatures/src/generators/networkquality.rs index ff2e9bab..fde1b43d 100644 --- a/command-signatures/src/generators/networkquality.rs +++ b/command-signatures/src/generators/networkquality.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "networksetup", Generator::script( CommandBuilder::single_command("networksetup -listallhardwareports"), - output_parsers::lines, + output_parsers::networksetup_ports, ), ) } diff --git a/command-signatures/src/generators/npx.rs b/command-signatures/src/generators/npx.rs index 0cd764ee..de88a644 100644 --- a/command-signatures/src/generators/npx.rs +++ b/command-signatures/src/generators/npx.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "until_node_modules_do_cd", Generator::script( CommandBuilder::single_command("until [[ -d node_modules/ ]] || [[ $PWD = '/' ]]; do cd ..; done; ls -1 node_modules/.bin/"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/nx.rs b/command-signatures/src/generators/nx.rs index 86944673..c9d2b05a 100644 --- a/command-signatures/src/generators/nx.rs +++ b/command-signatures/src/generators/nx.rs @@ -153,7 +153,7 @@ pub fn generator() -> CommandSignatureGenerators { ) .add_generator( "plugin_list", - Generator::command_from_tokens(super::fig_token::nx_list, super::output_parsers::lines), + Generator::command_from_tokens(super::fig_token::nx_list, super::output_parsers::named_lines), ) } diff --git a/command-signatures/src/generators/okteto.rs b/command-signatures/src/generators/okteto.rs index a0a3caa7..181e581c 100644 --- a/command-signatures/src/generators/okteto.rs +++ b/command-signatures/src/generators/okteto.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "context_list", Generator::script( CommandBuilder::single_command("okteto context list"), - output_parsers::lines_desc_context, + output_parsers::okteto_contexts, ), ) .add_generator( "namespace_list", Generator::script( CommandBuilder::single_command("okteto namespace list"), - output_parsers::lines, + output_parsers::okteto_namespaces, ), ) } diff --git a/command-signatures/src/generators/open.rs b/command-signatures/src/generators/open.rs index af24786d..774717db 100644 --- a/command-signatures/src/generators/open.rs +++ b/command-signatures/src/generators/open.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "mdfind", Generator::script( CommandBuilder::single_command("mdfind kMDItemContentTypeTree=com.apple.application-bundle -onlyin /"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( "mdfind_while_read_line", Generator::script( CommandBuilder::single_command(r#"mdfind kMDItemContentTypeTree=com.apple.application-bundle -onlyin / | while read line; do echo $(mdls -name kMDItemCFBundleIdentifier -r "$line") $line; done"#), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index cf837f5b..f328f322 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -8,23 +8,234 @@ pub fn lines(output: &str) -> GeneratorResults { .collect_unordered_results() } -pub fn lines_desc_extension(output: &str) -> GeneratorResults { +pub fn named_lines(output: &str) -> GeneratorResults { + lines(output) +} + +pub fn unique_named_lines(output: &str) -> GeneratorResults { + let mut seen = std::collections::HashSet::new(); + nonempty_lines(output) + .filter(|&line| seen.insert(line.to_string())) + .map(Suggestion::new) + .collect_unordered_results() +} + +pub fn desc_plugin(output: &str) -> GeneratorResults { + lines_with_desc(output, "Plugin") +} + +pub fn desc_plugin_name(output: &str) -> GeneratorResults { + lines_with_desc(output, "Plugin name") +} + +pub fn desc_remote(output: &str) -> GeneratorResults { + lines_with_desc(output, "Remote") +} + +pub fn desc_script(output: &str) -> GeneratorResults { + lines_with_desc(output, "Script") +} + +pub fn desc_version(output: &str) -> GeneratorResults { + lines_with_desc(output, "Version") +} + +pub fn desc_variable(output: &str) -> GeneratorResults { + lines_with_desc(output, "Variable name") +} + +pub fn desc_workspace(output: &str) -> GeneratorResults { + nonempty_lines(output) + .map(|line| Suggestion::with_description(line.replace('*', "").trim(), "Workspace")) + .collect_unordered_results() +} + +pub fn desc_terraform_workspace(output: &str) -> GeneratorResults { + nonempty_lines(output) + .map(|line| { + Suggestion::with_description(line.replace('*', "").trim(), "Terraform workspaces") + }) + .collect_unordered_results() +} + +pub fn desc_address(output: &str) -> GeneratorResults { + if output.contains("No state file") || output.contains("Error") { + return empty(); + } + nonempty_lines(output) + .map(|line| Suggestion::with_description(line.replace('*', "").trim(), "Address")) + .collect_unordered_results() +} + +pub fn git_status_short(output: &str) -> GeneratorResults { + let output = output.trim_start(); + if output.starts_with("fatal:") { + return empty(); + } + nonempty_lines(output) + .filter_map(|line| { + let path = line.get(3..)?.trim(); + (!path.is_empty()).then(|| Suggestion::with_description(path, line)) + }) + .collect_unordered_results() +} + +pub fn pre_commit_hook_ids(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter_map(|line| { + let trimmed = line.trim(); + let value = trimmed + .strip_prefix("- id:") + .or_else(|| trimmed.strip_prefix("id:"))?; + let name = value.trim().trim_matches('"'); + (!name.is_empty()).then(|| Suggestion::new(name)) + }) + .collect_unordered_results() +} + +pub fn deno_binaries(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter(|line| !line.ends_with("/deno")) + .map(|line| { + let name = line.rsplit('/').next().unwrap_or(line); + Suggestion::with_description(name, line) + }) + .collect_unordered_results() +} + +pub fn eslint_plugin_names(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter(|line| line.starts_with("eslint-plugin")) + .map(|line| { + let name = line.split_whitespace().next().unwrap_or(line); + Suggestion::new(name.get(14..).unwrap_or(name)) + }) + .collect_unordered_results() +} + +pub fn mix_help_tasks(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter_map(|line| { + let (name, description) = match line.split_once('#') { + Some((name, description)) => (name.trim(), description.trim()), + None => (line.trim(), ""), + }; + let name = name.strip_prefix("mix ").unwrap_or(name); + (!["mix", "help", "new", "run", "iex -S mix"].contains(&name)) + .then(|| Suggestion::with_description(name, description)) + }) + .collect_unordered_results() +} + +pub fn meteor_packages(output: &str) -> GeneratorResults { + if output.contains("No such file or directory") { + return empty(); + } + nonempty_lines(output) + .filter_map(|line| { + let name = line.split('#').next().unwrap_or(line).trim(); + let name = name.split('@').next().unwrap_or(name).trim(); + (!name.is_empty()).then(|| Suggestion::new(name)) + }) + .collect_unordered_results() +} + +pub fn meteor_examples(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter(|line| line.contains("github.com")) + .map(|line| Suggestion::new(line.split(':').next().unwrap_or(line).trim())) + .collect_unordered_results() +} + +pub fn softwareupdate_labels(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter_map(|line| { + line.strip_prefix("* Label: ").map(|name| { + Suggestion::with_description(format!("\"{name}\""), "Available update") + .with_display_name(Some(name.to_string())) + }) + }) + .collect_unordered_results() +} + +pub fn networksetup_ports(output: &str) -> GeneratorResults { + let re = regex::Regex::new(r"(?s)Hardware Port: (.*?)\n.*?Device: (.*?)(?:\n|$)").ok(); + let Some(re) = re else { + return empty(); + }; + re.captures_iter(output) + .filter_map(|caps| { + Some(Suggestion::with_description( + caps.get(2)?.as_str(), + caps.get(1)?.as_str(), + )) + }) + .collect_unordered_results() +} + +fn skip_star_first_token(output: &str, description: &'static str) -> GeneratorResults { + nonempty_lines(output) + .skip(1) + .filter_map(|line| { + let token = line.split_whitespace().next()?.replace('*', ""); + let name = token.trim(); + (!name.is_empty()).then(|| Suggestion::with_description(name, description)) + }) + .collect_unordered_results() +} + +pub fn okteto_contexts(output: &str) -> GeneratorResults { + skip_star_first_token(output, "Context") +} + +pub fn okteto_namespaces(output: &str) -> GeneratorResults { + skip_star_first_token(output, "Namespace") +} + +pub fn redwood_scripts(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter(|line| line.ends_with(".js") || line.ends_with(".ts")) + .map(|line| { + let name = line.trim(); + let name = name.rsplit_once('.').map(|(stem, _)| stem).unwrap_or(name); + Suggestion::with_description(name, "Script") + }) + .collect_unordered_results() +} + +pub fn wifi_networks(output: &str) -> GeneratorResults { + nonempty_lines(output) + .skip(1) + .map(|line| Suggestion::new(line.trim())) + .collect_unordered_results() +} + +pub fn gpg_ciphers(output: &str) -> GeneratorResults { + let Some(start) = output.find("Cypher: ").or_else(|| output.find("Cipher: ")) else { + return empty(); + }; + let rest = &output[start + 8..]; + let end = rest.find("Hash: ").unwrap_or(rest.len()); + let list = rest[..end].split_whitespace().collect::(); + list.split(',') + .filter(|part| !part.is_empty()) + .map(Suggestion::new) + .collect_unordered_results() +} + +pub fn desc_extension(output: &str) -> GeneratorResults { split_on(output, ';', "Extension") } -pub fn lines_desc_runtime(output: &str) -> GeneratorResults { +pub fn desc_runtime(output: &str) -> GeneratorResults { split_on(output, ',', "Runtime") } -pub fn lines_desc_instance(output: &str) -> GeneratorResults { +pub fn desc_instance(output: &str) -> GeneratorResults { lines_with_desc(output, "Instance name") } -pub fn lines_desc_context(output: &str) -> GeneratorResults { - skip_header_first_token(output, 1, "Context") -} - -pub fn lines_desc_warp_point(output: &str) -> GeneratorResults { +pub fn desc_warp_point(output: &str) -> GeneratorResults { nonempty_lines(output) .filter_map(|line| line.split_whitespace().next()) .map(|name| Suggestion::with_description(name, "Warp point")) @@ -549,6 +760,95 @@ pub fn scc_languages(output: &str) -> GeneratorResults { .collect_unordered_results() } +pub fn docker_search_names(output: &str) -> GeneratorResults { + nonempty_lines(output) + .filter_map(|line| { + json(line)? + .get("Name") + .and_then(Value::as_str) + .map(Suggestion::new) + }) + .collect_unordered_results() +} + +pub fn stepzen_schema_names(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + value + .as_str() + .map(|name| Suggestion::with_description(name, "StepZen endpoint")) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn stepzen_github_dirs(output: &str) -> GeneratorResults { + match json(output) { + Some(Value::Array(arr)) => arr + .into_iter() + .filter_map(|value| { + let kind = value.get("type")?.as_str()?; + let name = value.get("name")?.as_str()?; + (kind == "dir" && !name.starts_with('.')) + .then(|| Suggestion::with_description(name, "Stepzen schema")) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn youtube_dl_flat_playlist(output: &str) -> GeneratorResults { + match json(output).and_then(|v| v.get("entries").cloned()) { + Some(Value::Array(arr)) => arr + .into_iter() + .enumerate() + .map(|(index, entry)| { + let title = entry.get("title").and_then(Value::as_str).unwrap_or(""); + let uploader = entry.get("uploader").and_then(Value::as_str).unwrap_or(""); + let n = index + 1; + Suggestion::with_description(n.to_string(), uploader) + .with_display_name(Some(format!("{n} - {title}"))) + }) + .collect_unordered_results(), + _ => empty(), + } +} + +pub fn youtube_clipboard_url(output: &str) -> GeneratorResults { + let value = output.trim(); + let is_youtube = value.contains("youtube.com") || value.contains("youtu.be"); + if is_youtube { + std::iter::once(Suggestion::with_description(value, "Clipboard")) + .collect_unordered_results() + } else { + empty() + } +} + +pub fn lerna_package_script_keys(output: &str) -> GeneratorResults { + let mut names = std::collections::BTreeSet::new(); + for chunk in output.split("END") { + let chunk = chunk.trim(); + if chunk.is_empty() { + continue; + } + let Some(Value::Object(map)) = json(chunk) else { + continue; + }; + let Some(Value::Object(scripts)) = map.get("scripts") else { + continue; + }; + names.extend(scripts.keys().cloned()); + } + names + .into_iter() + .map(Suggestion::new) + .collect_unordered_results() +} + pub fn docker_from_as_names(output: &str) -> GeneratorResults { let re = regex::Regex::new(r"(?i)(?:as)\s+([\w:.-]+)").ok(); nonempty_lines(output) @@ -612,21 +912,6 @@ fn pipe_table( .collect_unordered_results() } -fn skip_header_first_token( - output: &str, - skip: usize, - description: &'static str, -) -> GeneratorResults { - nonempty_lines(output) - .skip(skip) - .filter_map(|line| { - let token = line.split_whitespace().next()?.replace('*', ""); - let name = token.trim(); - (!name.is_empty()).then(|| Suggestion::with_description(name, description)) - }) - .collect_unordered_results() -} - fn tailscale_peers_with_suffix(output: &str, suffix: &str) -> GeneratorResults { match json(output).and_then(|v| v.get("Peer").cloned()) { Some(Value::Object(map)) => map diff --git a/command-signatures/src/generators/pandoc.rs b/command-signatures/src/generators/pandoc.rs index 987c8307..dcd06989 100644 --- a/command-signatures/src/generators/pandoc.rs +++ b/command-signatures/src/generators/pandoc.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("pandoc --list-output-formats"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( "completions_list", Generator::script( CommandBuilder::single_command("pandoc --list-input-formats"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( @@ -23,7 +23,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "pandoc --list-input-formats && pandoc --list-output-formats", ), - output_parsers::lines, + output_parsers::unique_named_lines, ), ) .add_filter("filter-yaml", template_filters::yaml()) diff --git a/command-signatures/src/generators/pre_commit.rs b/command-signatures/src/generators/pre_commit.rs index e442aa72..d8a374b3 100644 --- a/command-signatures/src/generators/pre_commit.rs +++ b/command-signatures/src/generators/pre_commit.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_pre_commit_config_yaml", Generator::script( CommandBuilder::single_command("cat .pre-commit-config.yaml"), - output_parsers::lines, + output_parsers::pre_commit_hook_ids, ), ) .add_generator( @@ -16,7 +16,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch --no-color --sort=-committerdate", ), - output_parsers::lines, + crate::generators::git::post_process_branches, ), ) .add_generator( @@ -25,14 +25,14 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "git --no-optional-locks branch -a --no-color --sort=-committerdate", ), - output_parsers::lines, + crate::generators::git::post_process_branches, ), ) .add_generator( "git_remote", Generator::script( CommandBuilder::single_command("git --no-optional-locks remote -v"), - output_parsers::lines, + output_parsers::desc_remote, ), ) .add_generator( diff --git a/command-signatures/src/generators/quickmail.rs b/command-signatures/src/generators/quickmail.rs index af4a4d03..e8b628fa 100644 --- a/command-signatures/src/generators/quickmail.rs +++ b/command-signatures/src/generators/quickmail.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "template_listall", Generator::script( CommandBuilder::single_command("quickmail template listall"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/r.rs b/command-signatures/src/generators/r.rs index 4662817e..54e6063b 100644 --- a/command-signatures/src/generators/r.rs +++ b/command-signatures/src/generators/r.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "rscript_libpaths", Generator::script( CommandBuilder::single_command("Rscript -e '.libPaths()'"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_filter("filter-r", template_filters::r()) diff --git a/command-signatures/src/generators/rancher.rs b/command-signatures/src/generators/rancher.rs index 2609db9b..23816826 100644 --- a/command-signatures/src/generators/rancher.rs +++ b/command-signatures/src/generators/rancher.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "server", Generator::script( CommandBuilder::single_command("rancher server ls"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_filter("filter-json-yaml", template_filters::json_yaml()) diff --git a/command-signatures/src/generators/rclone.rs b/command-signatures/src/generators/rclone.rs index c0c6eb1e..fbfd89cb 100644 --- a/command-signatures/src/generators/rclone.rs +++ b/command-signatures/src/generators/rclone.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "listremotes", Generator::script( CommandBuilder::single_command("rclone listremotes"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/redwood.rs b/command-signatures/src/generators/redwood.rs index fbbda8ea..9fb9b656 100644 --- a/command-signatures/src/generators/redwood.rs +++ b/command-signatures/src/generators/redwood.rs @@ -8,7 +8,7 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "until [[ -f redwood.toml ]] || [[ $PWD = '/' ]]; do cd ..; done; ls -1p scripts/", ), - output_parsers::lines, + output_parsers::redwood_scripts, ), ) } diff --git a/command-signatures/src/generators/sftp.rs b/command-signatures/src/generators/sftp.rs index f8d95312..165d7ba9 100644 --- a/command-signatures/src/generators/sftp.rs +++ b/command-signatures/src/generators/sftp.rs @@ -14,7 +14,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_ssh_known_hosts", Generator::script( CommandBuilder::single_command("cat ~/.ssh/known_hosts"), - output_parsers::lines, + output_parsers::ssh_hosts, ), ) } diff --git a/command-signatures/src/generators/shortcuts.rs b/command-signatures/src/generators/shortcuts.rs index 7888d851..dd356cc5 100644 --- a/command-signatures/src/generators/shortcuts.rs +++ b/command-signatures/src/generators/shortcuts.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("shortcuts list"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( "list_shortcuts", Generator::script( CommandBuilder::single_command("shortcuts list --folders"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_filter("filter-shortcut", template_filters::shortcut()) diff --git a/command-signatures/src/generators/softwareupdate.rs b/command-signatures/src/generators/softwareupdate.rs index 06b583c2..f16486af 100644 --- a/command-signatures/src/generators/softwareupdate.rs +++ b/command-signatures/src/generators/softwareupdate.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("softwareupdate --list"), - output_parsers::lines, + output_parsers::softwareupdate_labels, ), ) } diff --git a/command-signatures/src/generators/stepzen.rs b/command-signatures/src/generators/stepzen.rs index 9781de36..dbd13772 100644 --- a/command-signatures/src/generators/stepzen.rs +++ b/command-signatures/src/generators/stepzen.rs @@ -9,14 +9,14 @@ pub fn generator() -> CommandSignatureGenerators { CommandBuilder::single_command( "curl https://api.github.com/repos/steprz/stepzen-schemas/contents", ), - output_parsers::lines, + output_parsers::stepzen_github_dirs, ), ) .add_generator( "list_schemas", Generator::script( CommandBuilder::single_command("stepzen list schemas"), - output_parsers::lines, + output_parsers::stepzen_schema_names, ), ) } diff --git a/command-signatures/src/generators/sysctl.rs b/command-signatures/src/generators/sysctl.rs index 062af9cc..9ecf1f6b 100644 --- a/command-signatures/src/generators/sysctl.rs +++ b/command-signatures/src/generators/sysctl.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("sysctl -A -N"), - output_parsers::lines, + output_parsers::desc_variable, ), ) } diff --git a/command-signatures/src/generators/tccutil.rs b/command-signatures/src/generators/tccutil.rs index e31776ba..d11f76a0 100644 --- a/command-signatures/src/generators/tccutil.rs +++ b/command-signatures/src/generators/tccutil.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "mdfind_applications_while_read", Generator::script( CommandBuilder::single_command(r#"mdfind kMDItemContentTypeTree=com.apple.application-bundle -onlyin /Applications | while read line; do echo $(mdls -name kMDItemCFBundleIdentifier -r "$line") $line; done"#), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/terragrunt.rs b/command-signatures/src/generators/terragrunt.rs index e5fcdfc5..a442ee89 100644 --- a/command-signatures/src/generators/terragrunt.rs +++ b/command-signatures/src/generators/terragrunt.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "state_list", Generator::script( CommandBuilder::single_command("terragrunt state list"), - output_parsers::lines, + output_parsers::desc_address, ), ) .add_generator( "workspace_list", Generator::script( CommandBuilder::single_command("terragrunt workspace list"), - output_parsers::lines, + output_parsers::desc_workspace, ), ) } diff --git a/command-signatures/src/generators/tfenv.rs b/command-signatures/src/generators/tfenv.rs index 1d10d89f..0e4246d1 100644 --- a/command-signatures/src/generators/tfenv.rs +++ b/command-signatures/src/generators/tfenv.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "list", Generator::script( CommandBuilder::single_command("tfenv list"), - output_parsers::lines, + output_parsers::desc_version, ), ) .add_generator( "list_remote", Generator::script( CommandBuilder::single_command("tfenv list-remote"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/tfsec.rs b/command-signatures/src/generators/tfsec.rs index 8c28c757..fb9fb131 100644 --- a/command-signatures/src/generators/tfsec.rs +++ b/command-signatures/src/generators/tfsec.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "terraform_workspace_list", Generator::script( CommandBuilder::single_command("terraform workspace list"), - output_parsers::lines, + output_parsers::desc_terraform_workspace, ), ) } diff --git a/command-signatures/src/generators/vultr_cli.rs b/command-signatures/src/generators/vultr_cli.rs index 62f840e3..ec6b5952 100644 --- a/command-signatures/src/generators/vultr_cli.rs +++ b/command-signatures/src/generators/vultr_cli.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "instance_list", Generator::script( CommandBuilder::single_command("vultr-cli instance list"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/watson.rs b/command-signatures/src/generators/watson.rs index 99c14637..fed2c9d4 100644 --- a/command-signatures/src/generators/watson.rs +++ b/command-signatures/src/generators/watson.rs @@ -14,14 +14,14 @@ pub fn generator() -> CommandSignatureGenerators { "projects", Generator::script( CommandBuilder::single_command("watson projects"), - output_parsers::lines, + output_parsers::named_lines, ), ) .add_generator( "tags", Generator::script( CommandBuilder::single_command("watson tags"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/wd.rs b/command-signatures/src/generators/wd.rs index 53c83ba1..955b46aa 100644 --- a/command-signatures/src/generators/wd.rs +++ b/command-signatures/src/generators/wd.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "cat_warprc", Generator::script( CommandBuilder::single_command("cat ~/.warprc"), - output_parsers::lines_desc_warp_point, + output_parsers::desc_warp_point, ), ) } diff --git a/command-signatures/src/generators/wifi_password.rs b/command-signatures/src/generators/wifi_password.rs index 0ba6e45f..2e30d598 100644 --- a/command-signatures/src/generators/wifi_password.rs +++ b/command-signatures/src/generators/wifi_password.rs @@ -7,7 +7,7 @@ pub fn generator() -> CommandSignatureGenerators { "networksetup_wi_fi_getline_print_networksetup", Generator::script( CommandBuilder::single_command("networksetup -listallhardwareports | awk '/Wi-Fi/{getline; print $2}' | xargs networksetup -listpreferredwirelessnetworks"), - output_parsers::lines, + output_parsers::wifi_networks, ), ) } diff --git a/command-signatures/src/generators/yo.rs b/command-signatures/src/generators/yo.rs index 05f81484..830eac12 100644 --- a/command-signatures/src/generators/yo.rs +++ b/command-signatures/src/generators/yo.rs @@ -6,7 +6,7 @@ pub fn generator() -> CommandSignatureGenerators { "completions", Generator::script( CommandBuilder::single_command("yo --generators"), - output_parsers::lines, + output_parsers::named_lines, ), ) } diff --git a/command-signatures/src/generators/youtube_dl.rs b/command-signatures/src/generators/youtube_dl.rs index 6a46fdce..c45264fc 100644 --- a/command-signatures/src/generators/youtube_dl.rs +++ b/command-signatures/src/generators/youtube_dl.rs @@ -7,14 +7,14 @@ pub fn generator() -> CommandSignatureGenerators { "pbpaste", Generator::script( CommandBuilder::single_command("pbpaste"), - output_parsers::lines, + output_parsers::youtube_clipboard_url, ), ) .add_generator( "flat_playlist", Generator::command_from_tokens( super::fig_token::youtube_dl_flat_playlist, - output_parsers::lines, + output_parsers::youtube_dl_flat_playlist, ), ) } From 685445a9fec6bd32938b217f48479374907e487f Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 19:57:59 +0000 Subject: [PATCH 07/20] Fix known_hosts hostname parsing and pre-commit YAML hook IDs Parse ~/.ssh/known_hosts host fields (comma lists, hashed skip, user@ prefix) for mosh/sftp/ssh instead of SSH-config Host directives. Walk pre-commit YAML repos[].hooks[].id scalars instead of matching raw id: text. --- .../src/generators/fig_token.rs | 35 +++++ command-signatures/src/generators/mosh.rs | 6 +- .../src/generators/output_parsers.rs | 130 ++++++++++++++++-- command-signatures/src/generators/sftp.rs | 6 +- command-signatures/src/generators/ssh.rs | 12 +- 5 files changed, 164 insertions(+), 25 deletions(-) diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index 717a8614..2a41f468 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -205,6 +205,27 @@ pub fn brew_gist_logs_actions(tokens: &[&str], _: bool, _: &[String]) -> Command } } +pub fn known_hosts_file( + tokens: &[&str], + has_trailing_whitespace: bool, + _: &[String], +) -> CommandBuilder { + let last = if has_trailing_whitespace { + "" + } else { + last_token(tokens) + }; + let prefix = user_at_prefix(last); + if prefix.is_empty() { + CommandBuilder::single_command("cat ~/.ssh/known_hosts") + } else { + CommandBuilder::single_command(format!( + "printf '%s\\n' {}; cat ~/.ssh/known_hosts", + shell_single_quote(&format!("WARP_SSH_USER_PREFIX={prefix}")) + )) + } +} + pub fn github_user_repos(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { let last = last_token(tokens); if last.contains(':') || !last.contains('/') { @@ -372,6 +393,20 @@ fn dockerfile_from_tokens(tokens: &[&str]) -> String { "$PWD/Dockerfile".to_string() } +fn user_at_prefix(token: &str) -> String { + let Some((user, _)) = token.split_once('@') else { + return String::new(); + }; + if user.is_empty() + || !user + .chars() + .all(|c| c.is_ascii_alphanumeric() || matches!(c, '.' | '_' | '-')) + { + return String::new(); + } + format!("{user}@") +} + fn last_token<'a>(tokens: &[&'a str]) -> &'a str { tokens.last().copied().unwrap_or("") } diff --git a/command-signatures/src/generators/mosh.rs b/command-signatures/src/generators/mosh.rs index b21e3429..ca9f70ec 100644 --- a/command-signatures/src/generators/mosh.rs +++ b/command-signatures/src/generators/mosh.rs @@ -12,9 +12,9 @@ pub fn generator() -> CommandSignatureGenerators { ) .add_generator( "cat_ssh_known_hosts", - Generator::script( - CommandBuilder::single_command("cat ~/.ssh/known_hosts"), - output_parsers::ssh_hosts, + Generator::command_from_tokens( + super::fig_token::known_hosts_file, + output_parsers::ssh_known_hosts, ), ) } diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index f328f322..b23efc8e 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -81,15 +81,30 @@ pub fn git_status_short(output: &str) -> GeneratorResults { } pub fn pre_commit_hook_ids(output: &str) -> GeneratorResults { - nonempty_lines(output) - .filter_map(|line| { - let trimmed = line.trim(); - let value = trimmed - .strip_prefix("- id:") - .or_else(|| trimmed.strip_prefix("id:"))?; - let name = value.trim().trim_matches('"'); - (!name.is_empty()).then(|| Suggestion::new(name)) - }) + yaml_pre_commit_hook_ids(output) + .into_iter() + .map(Suggestion::new) + .collect_unordered_results() +} + +pub fn ssh_known_hosts(output: &str) -> GeneratorResults { + let mut prefix = String::new(); + let mut seen = std::collections::HashSet::new(); + let mut hosts = Vec::new(); + for line in nonempty_lines(output) { + if let Some(rest) = line.strip_prefix("WARP_SSH_USER_PREFIX=") { + prefix = rest.to_string(); + continue; + } + for host in known_host_names(line) { + if seen.insert(host.clone()) { + hosts.push(host); + } + } + } + hosts + .into_iter() + .map(|host| Suggestion::with_description(format!("{prefix}{host}"), "SSH host")) .collect_unordered_results() } @@ -869,6 +884,103 @@ pub fn ssh_hosts(output: &str) -> GeneratorResults { .collect_unordered_results() } +fn known_host_names(line: &str) -> Vec { + let line = line.trim(); + if line.is_empty() || line.starts_with('#') { + return Vec::new(); + } + let mut fields = line.split_whitespace(); + let mut first = fields.next().unwrap_or(""); + if first.starts_with('@') { + first = fields.next().unwrap_or(""); + } + if first.is_empty() || first.starts_with("|1|") { + return Vec::new(); + } + first + .split(',') + .filter_map(|host| { + let host = host.trim(); + let host = host + .strip_prefix('[') + .and_then(|h| h.split(']').next()) + .unwrap_or(host); + if host.is_empty() || host.contains('*') { + None + } else { + Some(host.to_string()) + } + }) + .collect() +} + +fn yaml_pre_commit_hook_ids(output: &str) -> Vec { + let mut ids = Vec::new(); + let mut in_repos = false; + let mut in_hooks = false; + let mut repos_indent = usize::MAX; + let mut hooks_indent = usize::MAX; + for raw in output.lines() { + let indent = raw.chars().take_while(|c| *c == ' ' || *c == '\t').count(); + let trimmed = raw.trim(); + if trimmed.is_empty() || trimmed.starts_with('#') { + continue; + } + if in_repos && indent <= repos_indent && key_name(trimmed) != "repos" { + in_repos = false; + in_hooks = false; + } + if in_hooks && indent <= hooks_indent && key_name(trimmed) != "hooks" { + in_hooks = false; + } + match key_name(trimmed) { + "repos" => { + in_repos = true; + repos_indent = indent; + in_hooks = false; + continue; + } + "hooks" if in_repos => { + in_hooks = true; + hooks_indent = indent; + continue; + } + "id" if in_hooks => { + if let Some(id) = yaml_scalar_value(trimmed) { + ids.push(id); + } + } + _ => {} + } + } + ids +} + +fn key_name(trimmed: &str) -> &str { + let line = trimmed.strip_prefix("- ").unwrap_or(trimmed); + line.split(':').next().unwrap_or("").trim() +} + +fn yaml_scalar_value(trimmed: &str) -> Option { + let line = trimmed.strip_prefix("- ").unwrap_or(trimmed); + let (_, value) = line.split_once(':')?; + let mut value = value.trim(); + if let Some((code, _)) = value.split_once('#') { + if !value.starts_with('"') && !value.starts_with('\'') { + value = code.trim(); + } + } + if value.is_empty() || value == "|" || value == ">" || value == "{" || value == "[" { + return None; + } + if (value.starts_with('"') && value.ends_with('"') && value.len() >= 2) + || (value.starts_with('\'') && value.ends_with('\'') && value.len() >= 2) + { + value = &value[1..value.len() - 1]; + } + (!value.is_empty()).then(|| value.to_string()) +} + fn nonempty_lines(output: &str) -> impl Iterator { output .lines() diff --git a/command-signatures/src/generators/sftp.rs b/command-signatures/src/generators/sftp.rs index 165d7ba9..4d054b71 100644 --- a/command-signatures/src/generators/sftp.rs +++ b/command-signatures/src/generators/sftp.rs @@ -12,9 +12,9 @@ pub fn generator() -> CommandSignatureGenerators { ) .add_generator( "cat_ssh_known_hosts", - Generator::script( - CommandBuilder::single_command("cat ~/.ssh/known_hosts"), - output_parsers::ssh_hosts, + Generator::command_from_tokens( + super::fig_token::known_hosts_file, + output_parsers::ssh_known_hosts, ), ) } diff --git a/command-signatures/src/generators/ssh.rs b/command-signatures/src/generators/ssh.rs index 15bc7274..e3c1a409 100644 --- a/command-signatures/src/generators/ssh.rs +++ b/command-signatures/src/generators/ssh.rs @@ -1,7 +1,5 @@ use super::common; -use warp_completion_metadata::{ - CommandBuilder, CommandSignatureGenerators, Generator, GeneratorResultsCollector, Suggestion, -}; +use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("ssh") @@ -11,13 +9,7 @@ pub fn generator() -> CommandSignatureGenerators { "known_hosts", Generator::script( CommandBuilder::single_command("cat ~/.ssh/known_hosts"), - |output| { - output - .lines() - .filter_map(|line| line.split_once(' ').map(|(first, _)| first)) - .map(|known_host| Suggestion::with_description(known_host, "SSH Host")) - .collect_unordered_results() - }, + super::output_parsers::ssh_known_hosts, ), ) } From 61ac6332632ea4e973e912e57306236c8618fae1 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 20:02:33 +0000 Subject: [PATCH 08/20] Keep indentless YAML sequences inside pre-commit repos and hooks Sequence items at the same column as `repos:` or `hooks:` stay in that container; sibling mappings still end it. Quoted hook IDs strip wrapping quotes before comments. --- .../src/generators/output_parsers.rs | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index b23efc8e..9a7f8deb 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -926,11 +926,19 @@ fn yaml_pre_commit_hook_ids(output: &str) -> Vec { if trimmed.is_empty() || trimmed.starts_with('#') { continue; } - if in_repos && indent <= repos_indent && key_name(trimmed) != "repos" { + if in_repos + && indent <= repos_indent + && !is_sequence_item(trimmed) + && key_name(trimmed) != "repos" + { in_repos = false; in_hooks = false; } - if in_hooks && indent <= hooks_indent && key_name(trimmed) != "hooks" { + if in_hooks + && indent <= hooks_indent + && !is_sequence_item(trimmed) + && key_name(trimmed) != "hooks" + { in_hooks = false; } match key_name(trimmed) { @@ -956,6 +964,10 @@ fn yaml_pre_commit_hook_ids(output: &str) -> Vec { ids } +fn is_sequence_item(trimmed: &str) -> bool { + trimmed == "-" || trimmed.starts_with("- ") +} + fn key_name(trimmed: &str) -> &str { let line = trimmed.strip_prefix("- ").unwrap_or(trimmed); line.split(':').next().unwrap_or("").trim() @@ -964,21 +976,25 @@ fn key_name(trimmed: &str) -> &str { fn yaml_scalar_value(trimmed: &str) -> Option { let line = trimmed.strip_prefix("- ").unwrap_or(trimmed); let (_, value) = line.split_once(':')?; - let mut value = value.trim(); - if let Some((code, _)) = value.split_once('#') { - if !value.starts_with('"') && !value.starts_with('\'') { - value = code.trim(); - } - } + let value = value.trim(); if value.is_empty() || value == "|" || value == ">" || value == "{" || value == "[" { return None; } - if (value.starts_with('"') && value.ends_with('"') && value.len() >= 2) - || (value.starts_with('\'') && value.ends_with('\'') && value.len() >= 2) - { - value = &value[1..value.len() - 1]; + let quote = match value.as_bytes().first() { + Some(b) if *b == b'"' || *b == b'\'' => Some(*b as char), + _ => None, + }; + if let Some(quote) = quote { + let rest = &value[1..]; + let end = rest.find(quote)?; + let inner = &rest[..end]; + return (!inner.is_empty()).then(|| inner.to_string()); } - (!value.is_empty()).then(|| value.to_string()) + let unquoted = value + .split_once('#') + .map(|(code, _)| code.trim()) + .unwrap_or(value); + (!unquoted.is_empty()).then(|| unquoted.to_string()) } fn nonempty_lines(output: &str) -> impl Iterator { From a0bd1d664f667520a3d6eb98a4d26596f2fb0695 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 21:48:07 +0000 Subject: [PATCH 09/20] Key dynamic generators to the command Warp looks up Wire deno doc_json, register hub generators under hub, rename fig-teams.json to match fig-teams@latest, and align other filename/registry mismatches so JSON generatorName values resolve. --- command-signatures/json/deno.json | 2 +- .../{fig-teams.json => fig-teams@latest.json} | 0 command-signatures/src/generators/autojump.rs | 2 +- command-signatures/src/generators/bun.rs | 3 -- command-signatures/src/generators/cargo.rs | 2 - command-signatures/src/generators/deno.rs | 2 +- command-signatures/src/generators/git.rs | 38 ++++++++++++++----- command-signatures/src/generators/mod.rs | 3 ++ command-signatures/src/generators/ns.rs | 27 +++++++++---- .../src/generators/phpunit_watcher.rs | 2 +- .../src/generators/template_filters.rs | 26 ------------- 11 files changed, 56 insertions(+), 51 deletions(-) rename command-signatures/json/{fig-teams.json => fig-teams@latest.json} (100%) diff --git a/command-signatures/json/deno.json b/command-signatures/json/deno.json index d8e5a43e..e9758587 100644 --- a/command-signatures/json/deno.json +++ b/command-signatures/json/deno.json @@ -1280,7 +1280,7 @@ { "name": "filter", "isOptional": true, - "template": "filepaths" + "generatorName": "doc_json" } ] }, diff --git a/command-signatures/json/fig-teams.json b/command-signatures/json/fig-teams@latest.json similarity index 100% rename from command-signatures/json/fig-teams.json rename to command-signatures/json/fig-teams@latest.json diff --git a/command-signatures/src/generators/autojump.rs b/command-signatures/src/generators/autojump.rs index 8416397d..d8dce63d 100644 --- a/command-signatures/src/generators/autojump.rs +++ b/command-signatures/src/generators/autojump.rs @@ -2,7 +2,7 @@ use super::output_parsers; use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("autojump").add_generator( + CommandSignatureGenerators::new("j").add_generator( "cat", Generator::script( CommandBuilder::single_command(r#"cat "$HOME"/Library/autojump/autojump.txt"#), diff --git a/command-signatures/src/generators/bun.rs b/command-signatures/src/generators/bun.rs index 5d6742fa..1ca2e062 100644 --- a/command-signatures/src/generators/bun.rs +++ b/command-signatures/src/generators/bun.rs @@ -1,7 +1,6 @@ use warp_completion_metadata::CommandSignatureGenerators; use crate::generators::common::{dependencies_generator, get_scripts_generator}; -use crate::generators::template_filters; pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("bun") @@ -14,8 +13,6 @@ pub fn generator() -> CommandSignatureGenerators { crate::generators::output_parsers::npms_search_results, ), ) - .add_filter("filter-bun-script", template_filters::bun_script()) - .add_filter("filter-js-ts-family", template_filters::js_ts_family()) } #[cfg(test)] diff --git a/command-signatures/src/generators/cargo.rs b/command-signatures/src/generators/cargo.rs index 0b0af3ba..369ea22d 100644 --- a/command-signatures/src/generators/cargo.rs +++ b/command-signatures/src/generators/cargo.rs @@ -174,7 +174,5 @@ pub fn generator() -> CommandSignatureGenerators { .add_filter("filter-cargo-toml", template_filters::cargo_toml()) .add_filter("filter-cargo-lock", template_filters::cargo_lock()) .add_filter("filter-rustfmt-toml", template_filters::rustfmt_toml()) - .add_filter("filter-deny-toml", template_filters::deny_toml()) .add_filter("filter-rs", template_filters::rs()) - .add_filter("filter-snap", template_filters::snap()) } diff --git a/command-signatures/src/generators/deno.rs b/command-signatures/src/generators/deno.rs index b8494b61..c5e83f76 100644 --- a/command-signatures/src/generators/deno.rs +++ b/command-signatures/src/generators/deno.rs @@ -30,7 +30,7 @@ pub fn generator() -> CommandSignatureGenerators { "doc_json", Generator::command_from_tokens( super::fig_token::deno_doc_json, - output_parsers::json_string_array, + output_parsers::json_name_summary, ), ) } diff --git a/command-signatures/src/generators/git.rs b/command-signatures/src/generators/git.rs index cea814a9..6a94bfba 100644 --- a/command-signatures/src/generators/git.rs +++ b/command-signatures/src/generators/git.rs @@ -1028,18 +1028,45 @@ pub fn generator() -> CommandSignatureGenerators { }, ), ) +} + +fn git_generator_named(git: &CommandSignatureGenerators, name: &'static str) -> Generator { + git.generators() + .get(&GeneratorName::new(name)) + .cloned() + .unwrap_or_else(|| unreachable!("git registers {name}")) +} +/// `hub` is GitHub's git wrapper. Warp loads hub.json by filename (`hub`), not by +/// the spec's `name` field (`git`), so hub.json's generators must be keyed `hub`. +pub fn hub_generator() -> CommandSignatureGenerators { + let git = generator(); + CommandSignatureGenerators::new("hub") + .add_generator("aliases", git_generator_named(&git, "aliases")) + .add_generator("remotes", git_generator_named(&git, "remotes")) + .add_generator("revs", git_generator_named(&git, "revs")) + .add_generator( + "settings_generator", + git_generator_named(&git, "settings_generator"), + ) + .add_generator("stashes", git_generator_named(&git, "stashes")) + .add_generator("treeish", git_generator_named(&git, "treeish")) + .add_generator("tag", git_generator_named(&git, "tags")) .add_generator( "branches", Generator::script( - CommandBuilder::single_command("git --no-optional-locks branch --no-color --sort=-committerdate"), + CommandBuilder::single_command( + "git --no-optional-locks branch --no-color --sort=-committerdate", + ), post_process_branches, ), ) .add_generator( "branches_no", Generator::script( - CommandBuilder::single_command("git --no-optional-locks branch -a --no-color --sort=-committerdate"), + CommandBuilder::single_command( + "git --no-optional-locks branch -a --no-color --sort=-committerdate", + ), post_process_branches, ), ) @@ -1057,13 +1084,6 @@ pub fn generator() -> CommandSignatureGenerators { output_parsers::git_status_short, ), ) - .add_generator( - "tag", - Generator::script( - CommandBuilder::single_command("git --no-optional-locks tag --list --sort=-committerdate"), - post_process_tags, - ), - ) .add_generator( "status_staged_or_unstaged", Generator::command_from_tokens( diff --git a/command-signatures/src/generators/mod.rs b/command-signatures/src/generators/mod.rs index af86a2bb..791890b9 100644 --- a/command-signatures/src/generators/mod.rs +++ b/command-signatures/src/generators/mod.rs @@ -221,6 +221,7 @@ pub fn dynamic_command_signature_data() -> HashMap HashMap Generator { + Generator::script( + CommandBuilder::single_command( + "curl https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages", + ), + output_parsers::json_nativescript_templates, + ) +} + pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("ns") - .add_generator( - "nativescript_templates", - Generator::script( - CommandBuilder::single_command("curl https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages"), - output_parsers::json_nativescript_templates, - ), - ) + .add_generator("nativescript_templates", nativescript_templates()) +} + +pub fn tns_generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("tns") + .add_generator("nativescript_templates", nativescript_templates()) +} + +pub fn nativescript_generator() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("nativescript") + .add_generator("nativescript_templates", nativescript_templates()) } diff --git a/command-signatures/src/generators/phpunit_watcher.rs b/command-signatures/src/generators/phpunit_watcher.rs index 6cc20cfe..8cb6ec08 100644 --- a/command-signatures/src/generators/phpunit_watcher.rs +++ b/command-signatures/src/generators/phpunit_watcher.rs @@ -4,7 +4,7 @@ use warp_completion_metadata::{ }; pub fn generator() -> CommandSignatureGenerators { - CommandSignatureGenerators::new("phpunit").add_generator( + CommandSignatureGenerators::new("phpunit-watcher").add_generator( "tests", Generator::script( CommandBuilder::single_command("phpunit --list-tests"), diff --git a/command-signatures/src/generators/template_filters.rs b/command-signatures/src/generators/template_filters.rs index c218dc07..c58b1378 100644 --- a/command-signatures/src/generators/template_filters.rs +++ b/command-signatures/src/generators/template_filters.rs @@ -58,10 +58,6 @@ pub fn rs() -> TemplateFilter { TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["rs"], None)) } -pub fn snap() -> TemplateFilter { - TemplateFilter(|suggestion, path_type| folders_or_ext(suggestion, path_type, &["snap"], None)) -} - pub fn cargo_toml() -> TemplateFilter { TemplateFilter(|suggestion, path_type| { folders_or_equals(suggestion, path_type, &["Cargo.toml"]) @@ -80,10 +76,6 @@ pub fn rustfmt_toml() -> TemplateFilter { }) } -pub fn deny_toml() -> TemplateFilter { - TemplateFilter(|suggestion, path_type| folders_or_equals(suggestion, path_type, &["deny.toml"])) -} - pub fn js_ts_family() -> TemplateFilter { TemplateFilter(|suggestion, path_type| { folders_or_ext( @@ -95,24 +87,6 @@ pub fn js_ts_family() -> TemplateFilter { }) } -pub fn bun_script() -> TemplateFilter { - TemplateFilter(|mut suggestion, path_type| { - if path_type.is_folder() { - return Some(suggestion); - } - let name = suggestion.exact_string.to_ascii_lowercase(); - let matched = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs", ".mts", ".cts"] - .iter() - .any(|ext| name.ends_with(ext) || name.ends_with(&format!("{ext}/"))); - if matched { - suggestion.priority = Priority::Global(Importance::More(Order(76))); - Some(suggestion) - } else { - None - } - }) -} - pub fn deployctl() -> TemplateFilter { TemplateFilter(|suggestion, path_type| { folders_or_ext( From 03b5cf93695342476e1c6c641088c2ec2e666815 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 22:02:17 +0000 Subject: [PATCH 10/20] Fix Deno doc token command and DocNode envelope parser Join the filtered original token stream instead of prepending `deno doc`, and parse `deno doc --json` `{version, nodes}` using node name and jsDoc.doc. --- command-signatures/src/generators/deno.rs | 2 +- .../src/generators/fig_token.rs | 24 +++++++++++++++---- .../src/generators/output_parsers.rs | 23 ++++++++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/command-signatures/src/generators/deno.rs b/command-signatures/src/generators/deno.rs index c5e83f76..c579b60b 100644 --- a/command-signatures/src/generators/deno.rs +++ b/command-signatures/src/generators/deno.rs @@ -30,7 +30,7 @@ pub fn generator() -> CommandSignatureGenerators { "doc_json", Generator::command_from_tokens( super::fig_token::deno_doc_json, - output_parsers::json_name_summary, + output_parsers::json_deno_doc_nodes, ), ) } diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index 2a41f468..8e05d818 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -130,19 +130,33 @@ pub fn youtube_dl_flat_playlist(tokens: &[&str], _: bool, _: &[String]) -> Comma } } -pub fn deno_doc_json(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { +pub fn deno_doc_json( + tokens: &[&str], + has_trailing_whitespace: bool, + _: &[String], +) -> CommandBuilder { let keep = ["--private", "--builtin", "--unstable"]; - let mut args: Vec = tokens + let complete = if has_trailing_whitespace || tokens.len() <= 1 { + tokens + } else { + &tokens[..tokens.len() - 1] + }; + let mut args: Vec = complete .iter() .copied() - .take(tokens.len().saturating_sub(1)) .filter(|t| { - (!t.starts_with('-') || keep.contains(t)) && !t.starts_with('$') && !t.starts_with('(') + !t.is_empty() + && (!t.starts_with('-') || keep.contains(t)) + && !t.starts_with('$') + && !t.starts_with('(') }) .map(shell_single_quote) .collect(); + if args.is_empty() { + return CommandBuilder::single_command("true"); + } args.push("--json".to_string()); - CommandBuilder::single_command(format!("deno doc {}", args.join(" "))) + CommandBuilder::single_command(args.join(" ")) } pub fn git_status_staged_or_unstaged(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index 9a7f8deb..842fdcc7 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -285,6 +285,29 @@ pub fn json_name_summary(output: &str) -> GeneratorResults { } } +pub fn json_deno_doc_nodes(output: &str) -> GeneratorResults { + let Some(value) = json(output) else { + return empty(); + }; + let Some(nodes) = value.get("nodes").and_then(Value::as_array) else { + return empty(); + }; + nodes + .iter() + .filter_map(|node| { + let name = node.get("name")?.as_str()?; + (!name.is_empty()).then(|| { + let description = node + .get("jsDoc") + .and_then(|js_doc| js_doc.get("doc")) + .and_then(Value::as_str) + .unwrap_or(""); + Suggestion::with_description(name, description) + }) + }) + .collect_unordered_results() +} + pub fn json_string_array(output: &str) -> GeneratorResults { match json(output) { Some(Value::Array(arr)) => arr From 323a28a1dd2f16feb9f72300d560724e3e68f5c1 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 22:38:35 +0000 Subject: [PATCH 11/20] Fix dd conv= remaining suggestions and drop Trivy filepaths Preserve the `conv=` token prefix so remaining conversion names match, and remove leftover filepaths templates from Trivy remaining-enum args. --- command-signatures/json/trivy.json | 18 --------- .../src/generators/fig_token.rs | 39 +++++++++++++++---- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/command-signatures/json/trivy.json b/command-signatures/json/trivy.json index 534dbb37..cae12c45 100644 --- a/command-signatures/json/trivy.json +++ b/command-signatures/json/trivy.json @@ -44,7 +44,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } @@ -80,7 +79,6 @@ "description": "Comma-separated list of vulnerability types (os,library) (default: \"os,library\") [$TRIVY_VULN_TYPE]", "args": { "name": "vulnType", - "template": "filepaths", "default": "os,library", "generatorName": "pkg_types_remaining" } @@ -90,7 +88,6 @@ "description": "Comma-separated list of what security issues to detect (vuln,config) (default: \"vuln\") [$TRIVY_SECURITY_CHECKS]", "args": { "name": "securityChecks", - "template": "filepaths", "default": "vuln", "generatorName": "scanners_remaining" } @@ -246,7 +243,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } @@ -282,7 +278,6 @@ "description": "Comma-separated list of vulnerability types (os,library) (default: \"os,library\") [$TRIVY_VULN_TYPE]", "args": { "name": "vulnType", - "template": "filepaths", "default": "os,library", "generatorName": "pkg_types_remaining" } @@ -292,7 +287,6 @@ "description": "Comma-separated list of what security issues to detect (vuln,config) (default: \"vuln\") [$TRIVY_SECURITY_CHECKS]", "args": { "name": "securityChecks", - "template": "filepaths", "default": "vuln", "generatorName": "scanners_remaining" } @@ -474,7 +468,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } @@ -510,7 +503,6 @@ "description": "Comma-separated list of vulnerability types (os,library) (default: \"os,library\") [$TRIVY_VULN_TYPE]", "args": { "name": "vulnType", - "template": "filepaths", "default": "os,library", "generatorName": "pkg_types_remaining" } @@ -520,7 +512,6 @@ "description": "Comma-separated list of what security issues to detect (vuln,config) (default: \"vuln\") [$TRIVY_SECURITY_CHECKS]", "args": { "name": "securityChecks", - "template": "filepaths", "default": "vuln", "generatorName": "scanners_remaining" } @@ -677,7 +668,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } @@ -777,7 +767,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } @@ -813,7 +802,6 @@ "description": "Comma-separated list of vulnerability types (os,library) (default: \"os,library\") [$TRIVY_VULN_TYPE]", "args": { "name": "vulnType", - "template": "filepaths", "default": "os,library", "generatorName": "pkg_types_remaining" } @@ -823,7 +811,6 @@ "description": "Comma-separated list of what security issues to detect (vuln,config) (default: \"vuln\") [$TRIVY_SECURITY_CHECKS]", "args": { "name": "securityChecks", - "template": "filepaths", "default": "vuln", "generatorName": "scanners_remaining" } @@ -974,7 +961,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } @@ -1010,7 +996,6 @@ "description": "Comma-separated list of vulnerability types (os,library) (default: \"os,library\") [$TRIVY_VULN_TYPE]", "args": { "name": "vulnType", - "template": "filepaths", "default": "os,library", "generatorName": "pkg_types_remaining" } @@ -1020,7 +1005,6 @@ "description": "Comma-separated list of what security issues to detect (vuln,config) (default: \"vuln\") [$TRIVY_SECURITY_CHECKS]", "args": { "name": "securityChecks", - "template": "filepaths", "default": "vuln", "generatorName": "scanners_remaining" } @@ -1094,7 +1078,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } @@ -1285,7 +1268,6 @@ "description": "Severities of vulnerabilities to be displayed (comma separated) (default: \"UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL\") [$TRIVY_SEVERITY]", "args": { "name": "severity", - "template": "filepaths", "default": "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL", "generatorName": "severity_remaining" } diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index 8e05d818..1be3786b 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -382,20 +382,45 @@ fn remaining_csv(tokens: &[&str], options: &[&str]) -> CommandBuilder { } fn remaining_delimited(tokens: &[&str], options: &[&str], delimiter: char) -> CommandBuilder { - let used: std::collections::HashSet<&str> = last_token(tokens) - .split(delimiter) - .filter(|s| !s.is_empty()) - .collect(); + let last = last_token(tokens); + let (insert_prefix, csv) = last + .rsplit_once('=') + .filter(|(head, _)| { + !head.is_empty() + && !head.contains(delimiter) + && head + .chars() + .all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_')) + }) + .map(|(head, rest)| (format!("{head}="), rest)) + .unwrap_or_else(|| (String::new(), last)); + let ends_with_delim = csv.ends_with(delimiter); + let mut parts: Vec<&str> = csv.split(delimiter).filter(|s| !s.is_empty()).collect(); + if !csv.is_empty() && !ends_with_delim { + parts.pop(); + } + let used: std::collections::HashSet<&str> = parts.iter().copied().collect(); let left: Vec<&str> = options .iter() .copied() .filter(|o| !used.contains(o)) .collect(); if left.is_empty() { - CommandBuilder::single_command("true") - } else { - CommandBuilder::single_command(format!("printf '%s\\n' {}", left.join(" "))) + return CommandBuilder::single_command("true"); } + let already = if parts.is_empty() { + insert_prefix + } else { + format!( + "{insert_prefix}{}{delimiter}", + parts.join(&delimiter.to_string()) + ) + }; + let rendered: Vec = left + .iter() + .map(|option| format!("{already}{option}")) + .collect(); + CommandBuilder::single_command(format!("printf '%s\\n' {}", rendered.join(" "))) } fn dockerfile_from_tokens(tokens: &[&str]) -> String { From 1763ec88a1a36b6161b5977ee758614abbfc473e Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 23:15:25 +0000 Subject: [PATCH 12/20] Fix hub staged-file parser, chown groups, and scc -f remaining Parse hub status --short as paths, list Linux groups with a colon prefix, and keep scc -f on remaining formats instead of colon path completion. --- .../src/generators/fig_token.rs | 49 +++++++++---------- command-signatures/src/generators/git.rs | 2 +- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index 1be3786b..9a96800a 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -94,14 +94,16 @@ pub fn cargo_test_list(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder } pub fn chown_dscl(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { - let has_colon = tokens.iter().any(|t| t.contains(':')); - if has_colon { - CommandBuilder::single_command( - "dscl . -list /Groups PrimaryGroupID 2>/dev/null | tr -s ' ' | sort -r", - ) + let last = last_token(tokens); + if let Some((user, _)) = last.split_once(':') { + let prefix = format!("{user}:"); + CommandBuilder::single_command(format!( + r#"{{ getent group 2>/dev/null | cut -d: -f1; dscl . -list /Groups PrimaryGroupID 2>/dev/null | awk '{{print $1}}'; }} | awk -v p={} 'NF && !seen[$0]++ {{ print p $0 }}'"#, + shell_single_quote(&prefix) + )) } else { CommandBuilder::single_command( - "dscl . -list /Users UniqueID 2>/dev/null | tr -s ' ' | sort -r", + r#"{ getent passwd 2>/dev/null | cut -d: -f1; dscl . -list /Users UniqueID 2>/dev/null | awk '{print $1}'; } | awk 'NF && !seen[$0]++'"#, ) } } @@ -326,26 +328,21 @@ pub fn robot_variables(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder } pub fn scc_output_paths(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { - let last = last_token(tokens); - if last.contains(':') { - CommandBuilder::single_command("ls -1AF; printf '%s\\n' stdout") - } else { - remaining_csv( - tokens, - &[ - "tabular", - "wide", - "json", - "csv", - "csv-stream", - "cloc-yaml", - "html", - "html-table", - "sql", - "sql-insert", - ], - ) - } + remaining_csv( + tokens, + &[ + "tabular", + "wide", + "json", + "csv", + "csv-stream", + "cloc-yaml", + "html", + "html-table", + "sql", + "sql-insert", + ], + ) } pub fn esbuild_loader(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { diff --git a/command-signatures/src/generators/git.rs b/command-signatures/src/generators/git.rs index 6a94bfba..c5af4931 100644 --- a/command-signatures/src/generators/git.rs +++ b/command-signatures/src/generators/git.rs @@ -1088,7 +1088,7 @@ pub fn hub_generator() -> CommandSignatureGenerators { "status_staged_or_unstaged", Generator::command_from_tokens( super::fig_token::git_status_staged_or_unstaged, - output_parsers::git_oneline, + output_parsers::git_status_short, ), ) } From f205ca5d22130fd4120e7738ff39ba9b619d9b6b Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 23:23:22 +0000 Subject: [PATCH 13/20] Slice git status --short paths from untrimmed XY lines Keep the fatal: guard on a trimmed view of the whole output, but slice column 3 from the original status line so a leading space in XY is not eaten before the path. --- command-signatures/src/generators/output_parsers.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index 842fdcc7..2eb1f3f8 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -68,11 +68,12 @@ pub fn desc_address(output: &str) -> GeneratorResults { } pub fn git_status_short(output: &str) -> GeneratorResults { - let output = output.trim_start(); - if output.starts_with("fatal:") { + if output.trim_start().starts_with("fatal:") { return empty(); } - nonempty_lines(output) + output + .lines() + .filter(|line| !line.is_empty()) .filter_map(|line| { let path = line.get(3..)?.trim(); (!path.is_empty()).then(|| Suggestion::with_description(path, line)) From c3c091c1be7ee102f975e4a16b61e126702441b0 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 00:30:24 +0000 Subject: [PATCH 14/20] Fix shard-2 generator wiring for pnpm add, docker stages, cargo tests, and j Wire npms_search on top-level pnpm add. Expand $PWD/Dockerfile instead of single-quoting it, and drop leftover filepaths from docker --target. Do not grep cargo test -- --list for the --test flag, attach test_list to TESTNAME, and read autojump's Linux db path as well as the macOS one. --- command-signatures/json/cargo.json | 10 ++---- command-signatures/json/docker.json | 3 -- command-signatures/json/pnpm.json | 3 +- command-signatures/src/generators/autojump.rs | 4 ++- .../src/generators/fig_token.rs | 36 ++++++++++--------- 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/command-signatures/json/cargo.json b/command-signatures/json/cargo.json index 618ce45d..05dcabd5 100644 --- a/command-signatures/json/cargo.json +++ b/command-signatures/json/cargo.json @@ -32,7 +32,6 @@ "isRepeatable": true, "args": { "name": "test", - "template": "filepaths", "isVariadic": true, "generatorName": "test_list" } @@ -323,7 +322,6 @@ "isRepeatable": true, "args": { "name": "test", - "template": "filepaths", "isVariadic": true, "generatorName": "test_list" } @@ -588,7 +586,6 @@ "isRepeatable": true, "args": { "name": "test", - "template": "filepaths", "isVariadic": true, "generatorName": "test_list" } @@ -1495,7 +1492,6 @@ "isRepeatable": true, "args": { "name": "test", - "template": "filepaths", "isVariadic": true, "generatorName": "test_list" } @@ -3830,7 +3826,6 @@ "isRepeatable": true, "args": { "name": "test", - "template": "filepaths", "isVariadic": true, "generatorName": "test_list" } @@ -4083,7 +4078,6 @@ "isRepeatable": true, "args": { "name": "test", - "template": "filepaths", "isVariadic": true, "generatorName": "test_list" } @@ -4395,7 +4389,6 @@ "isRepeatable": true, "args": { "name": "test", - "template": "filepaths", "isVariadic": true, "generatorName": "test_list" } @@ -4630,7 +4623,8 @@ ], "args": [ { - "name": "TESTNAME" + "name": "TESTNAME", + "generatorName": "test_list" }, { "name": "args", diff --git a/command-signatures/json/docker.json b/command-signatures/json/docker.json index e848c8f0..ad850ca8 100644 --- a/command-signatures/json/docker.json +++ b/command-signatures/json/docker.json @@ -177,7 +177,6 @@ "description": "Set the target build stage to build", "args": { "name": "target build stage", - "template": "filepaths", "generatorName": "from_as" } } @@ -2930,7 +2929,6 @@ "description": "Set the target build stage to build", "args": { "name": "target build stage", - "template": "filepaths", "generatorName": "from_as" } } @@ -5642,7 +5640,6 @@ "description": "Set the target build stage to build", "args": { "name": "target build stage", - "template": "filepaths", "generatorName": "from_as" } } diff --git a/command-signatures/json/pnpm.json b/command-signatures/json/pnpm.json index aa1bf26f..8450e97b 100644 --- a/command-signatures/json/pnpm.json +++ b/command-signatures/json/pnpm.json @@ -28,7 +28,8 @@ "args": { "name": "package", "debounce": true, - "isVariadic": true + "isVariadic": true, + "generatorName": "npms_search" }, "options": [ { diff --git a/command-signatures/src/generators/autojump.rs b/command-signatures/src/generators/autojump.rs index d8dce63d..b9027da1 100644 --- a/command-signatures/src/generators/autojump.rs +++ b/command-signatures/src/generators/autojump.rs @@ -5,7 +5,9 @@ pub fn generator() -> CommandSignatureGenerators { CommandSignatureGenerators::new("j").add_generator( "cat", Generator::script( - CommandBuilder::single_command(r#"cat "$HOME"/Library/autojump/autojump.txt"#), + CommandBuilder::single_command( + r#"cat "$HOME/Library/autojump/autojump.txt" "$HOME/.local/share/autojump/autojump.txt" 2>/dev/null"#, + ), output_parsers::named_lines, ), ) diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index 9a96800a..d8f45995 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -38,11 +38,15 @@ pub fn trivy_pkg_types_remaining(tokens: &[&str], _: bool, _: &[String]) -> Comm } pub fn docker_from_as(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { - let file = dockerfile_from_tokens(tokens); - CommandBuilder::single_command(format!( - r#"grep -iE 'FROM.*AS' {} 2>/dev/null"#, - shell_single_quote(&file) - )) + if let Some(i) = tokens.iter().position(|t| *t == "-f" || *t == "--file") { + if let Some(file) = tokens.get(i + 1) { + return CommandBuilder::single_command(format!( + r#"grep -iE 'FROM.*AS' {} 2>/dev/null"#, + shell_single_quote(file), + )); + } + } + CommandBuilder::single_command(r#"grep -iE 'FROM.*AS' "$PWD/Dockerfile" 2>/dev/null"#) } pub fn docker_search(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { @@ -82,8 +86,17 @@ pub fn apt_list_prefix(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder } } -pub fn cargo_test_list(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { - let token = last_token(tokens); +pub fn cargo_test_list( + tokens: &[&str], + has_trailing_whitespace: bool, + _: &[String], +) -> CommandBuilder { + let token = if has_trailing_whitespace { + "" + } else { + last_token(tokens) + }; + let token = if token.starts_with('-') { "" } else { token }; let depth = token.split("::").filter(|s| !s.is_empty()).count().max(1); let last = token.split("::").last().unwrap_or(""); CommandBuilder::single_command(format!( @@ -420,15 +433,6 @@ fn remaining_delimited(tokens: &[&str], options: &[&str], delimiter: char) -> Co CommandBuilder::single_command(format!("printf '%s\\n' {}", rendered.join(" "))) } -fn dockerfile_from_tokens(tokens: &[&str]) -> String { - if let Some(i) = tokens.iter().position(|t| *t == "-f" || *t == "--file") { - if i + 1 < tokens.len() { - return tokens[i + 1].to_string(); - } - } - "$PWD/Dockerfile".to_string() -} - fn user_at_prefix(token: &str) -> String { let Some((user, _)) = token.split_once('@') else { return String::new(); From 88bda1cdc21cfdf48df25463c0e02342928aba67 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 00:37:59 +0000 Subject: [PATCH 15/20] Key hub, nativescript, tns, and j specs to the typed command Warp's case-sensitive lookup rejects a spec whose name field differs from the filename token, so hub.json named git never attached. Match each spec name to its file, and send a GitHub User-Agent when listing NativeScript templates. --- command-signatures/json/hub.json | 2 +- command-signatures/json/j.json | 2 +- command-signatures/json/nativescript.json | 2 +- command-signatures/json/tns.json | 2 +- command-signatures/src/generators/ns.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/command-signatures/json/hub.json b/command-signatures/json/hub.json index b3abc90f..a0bd131d 100644 --- a/command-signatures/json/hub.json +++ b/command-signatures/json/hub.json @@ -1,5 +1,5 @@ { - "name": "git", + "name": "hub", "description": "The stupid content tracker", "generateSpec": "_NuFrRa_(o,t)=>p(void 0,null,function*(){let r=(yield t(\"compgen -c | grep git- | cut -c5- | sort -u\")).trim();return r===\"\"?{name:\"git\"}:{name:\"git\",subcommands:r.split(`\n`).map(a=>{var s;return f({name:a},(s=q[a])!=null?s:{description:`Run git-${a}`})})}})", "args": { diff --git a/command-signatures/json/j.json b/command-signatures/json/j.json index 6c6b1dbb..9fe48d24 100644 --- a/command-signatures/json/j.json +++ b/command-signatures/json/j.json @@ -1,5 +1,5 @@ { - "name": "autojump", + "name": "j", "description": "A faster way to navigate your filesystem", "options": [ { diff --git a/command-signatures/json/nativescript.json b/command-signatures/json/nativescript.json index 7de73f1c..2b3e20a8 100644 --- a/command-signatures/json/nativescript.json +++ b/command-signatures/json/nativescript.json @@ -1,5 +1,5 @@ { - "name": "ns", + "name": "nativescript", "description": "The NativeScript CLI lets you create, build, and deploy NativeScript based apps on iOS and Android devices", "subcommands": [ { diff --git a/command-signatures/json/tns.json b/command-signatures/json/tns.json index 7de73f1c..0da63a03 100644 --- a/command-signatures/json/tns.json +++ b/command-signatures/json/tns.json @@ -1,5 +1,5 @@ { - "name": "ns", + "name": "tns", "description": "The NativeScript CLI lets you create, build, and deploy NativeScript based apps on iOS and Android devices", "subcommands": [ { diff --git a/command-signatures/src/generators/ns.rs b/command-signatures/src/generators/ns.rs index 3dcd4163..2a203d24 100644 --- a/command-signatures/src/generators/ns.rs +++ b/command-signatures/src/generators/ns.rs @@ -4,7 +4,7 @@ use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Gener fn nativescript_templates() -> Generator { Generator::script( CommandBuilder::single_command( - "curl https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages", + "curl -sfL -H 'User-Agent: warp-completions' -H 'Accept: application/vnd.github+json' https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages", ), output_parsers::json_nativescript_templates, ) From 9d2956bcf0cb3a964021fd78e04a8ae8f1fc88f3 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 00:41:51 +0000 Subject: [PATCH 16/20] Suggest Cargo --test integration targets from metadata Keep test_list on positional TESTNAME. --test now uses cargo metadata targets whose kind contains test, matching names like integration_target rather than test function names. --- command-signatures/json/cargo.json | 14 +++---- command-signatures/src/generators/cargo.rs | 46 +++++++++++----------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/command-signatures/json/cargo.json b/command-signatures/json/cargo.json index 05dcabd5..a8646986 100644 --- a/command-signatures/json/cargo.json +++ b/command-signatures/json/cargo.json @@ -33,7 +33,7 @@ "args": { "name": "test", "isVariadic": true, - "generatorName": "test_list" + "generatorName": "test_targets" } }, { @@ -323,7 +323,7 @@ "args": { "name": "test", "isVariadic": true, - "generatorName": "test_list" + "generatorName": "test_targets" } }, { @@ -587,7 +587,7 @@ "args": { "name": "test", "isVariadic": true, - "generatorName": "test_list" + "generatorName": "test_targets" } }, { @@ -1493,7 +1493,7 @@ "args": { "name": "test", "isVariadic": true, - "generatorName": "test_list" + "generatorName": "test_targets" } }, { @@ -3827,7 +3827,7 @@ "args": { "name": "test", "isVariadic": true, - "generatorName": "test_list" + "generatorName": "test_targets" } }, { @@ -4079,7 +4079,7 @@ "args": { "name": "test", "isVariadic": true, - "generatorName": "test_list" + "generatorName": "test_targets" } }, { @@ -4390,7 +4390,7 @@ "args": { "name": "test", "isVariadic": true, - "generatorName": "test_list" + "generatorName": "test_targets" } }, { diff --git a/command-signatures/src/generators/cargo.rs b/command-signatures/src/generators/cargo.rs index 369ea22d..80bf5d9b 100644 --- a/command-signatures/src/generators/cargo.rs +++ b/command-signatures/src/generators/cargo.rs @@ -112,28 +112,14 @@ pub fn generator() -> CommandSignatureGenerators { "bin_list", Generator::script( CommandBuilder::single_command("cargo metadata --no-deps --format-version 1"), - |output| { - let metadata: Result = serde_json::from_str(output); - - match metadata { - Ok(metadata) => metadata - .packages - .into_iter() - .flat_map(|package| package.targets.into_iter().flatten()) - .filter_map(|target| { - target - .kind - .into_iter() - .any(|item| item == "bin") - .then(|| Suggestion::new(target.name)) - }) - .collect_unordered_results(), - Err(e) => { - log::error!("Couldn't parse cargo metadata with error {}", e); - GeneratorResults::default() - } - } - }, + |output| metadata_targets_of_kind(output, "bin"), + ), + ) + .add_generator( + "test_targets", + Generator::script( + CommandBuilder::single_command("cargo metadata --no-deps --format-version 1"), + |output| metadata_targets_of_kind(output, "test"), ), ) .add_generator( @@ -176,3 +162,19 @@ pub fn generator() -> CommandSignatureGenerators { .add_filter("filter-rustfmt-toml", template_filters::rustfmt_toml()) .add_filter("filter-rs", template_filters::rs()) } + +fn metadata_targets_of_kind(output: &str, kind: &str) -> GeneratorResults { + match serde_json::from_str::(output) { + Ok(metadata) => metadata + .packages + .into_iter() + .flat_map(|package| package.targets.into_iter().flatten()) + .filter(|target| target.kind.iter().any(|item| item == kind)) + .map(|target| Suggestion::new(target.name)) + .collect_unordered_results(), + Err(e) => { + log::error!("Couldn't parse cargo metadata with error {e}"); + GeneratorResults::default() + } + } +} From e364a9b86df22b6b83826051343dc1552053920b Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 01:28:56 +0000 Subject: [PATCH 17/20] Match direnv file completions to basename .envrc contains(\".envrc\") accepted .envrc.txt. Keep folders for navigation and only boost files named .envrc. --- .../src/generators/template_filters.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/command-signatures/src/generators/template_filters.rs b/command-signatures/src/generators/template_filters.rs index c58b1378..ab6d1e10 100644 --- a/command-signatures/src/generators/template_filters.rs +++ b/command-signatures/src/generators/template_filters.rs @@ -14,11 +14,16 @@ pub fn yml_yaml() -> TemplateFilter { pub fn envrc() -> TemplateFilter { TemplateFilter(|mut suggestion, path_type| { - let is_envrc = suggestion.exact_string.contains(".envrc"); - if path_type.is_folder() || is_envrc { - if is_envrc { - suggestion.priority = Priority::Global(Importance::More(Order(76))); - } + if path_type.is_folder() { + return Some(suggestion); + } + let name = suggestion.exact_string.as_str(); + let is_envrc = name == ".envrc" + || name == ".envrc/" + || name.ends_with("/.envrc") + || name.ends_with("/.envrc/"); + if is_envrc { + suggestion.priority = Priority::Global(Importance::More(Order(76))); Some(suggestion) } else { None From a0fdaff6b260a87f08433b720f3792fd38c38130 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 01:42:36 +0000 Subject: [PATCH 18/20] Use portable find for esbuild loader extension fallback GNU find treats -depth as a boolean, so -depth 3 failed with paths must precede expression. Use -maxdepth 3, and still emit loader types when Warp splits --loader: so the last token has no colon. --- command-signatures/src/generators/fig_token.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index d8f45995..33948dda 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -360,7 +360,7 @@ pub fn scc_output_paths(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilde pub fn esbuild_loader(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder { let last = last_token(tokens); - if last.contains(':') { + if last.contains(':') || last == "--loader" || last == "--banner" { remaining_delimited( tokens, &[ @@ -371,7 +371,7 @@ pub fn esbuild_loader(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder ) } else { CommandBuilder::single_command( - "find . -depth 3 -type f -name '*.*' -not -path '*/node_modules/*' | sed 's/.*\\.//' | sort -u", + "find . -maxdepth 3 -type f -name '*.*' ! -path '*/node_modules/*' | sed 's/.*\\.//' | sort -u", ) } } From 76992f798d52e1964c2e8dcfab760aedccfa0f6e Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 01:48:22 +0000 Subject: [PATCH 19/20] Drop maxdepth from esbuild loader find fallback -maxdepth is not portable across BSD find. Keep -type f, name filter, and node_modules exclusion so GNU and macOS find both list extensions. --- command-signatures/src/generators/fig_token.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index 33948dda..ea45211d 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -371,7 +371,7 @@ pub fn esbuild_loader(tokens: &[&str], _: bool, _: &[String]) -> CommandBuilder ) } else { CommandBuilder::single_command( - "find . -maxdepth 3 -type f -name '*.*' ! -path '*/node_modules/*' | sed 's/.*\\.//' | sort -u", + "find . -type f -name '*.*' ! -path '*/node_modules/*' | sed 's/.*\\.//' | sort -u", ) } } From e3b09c9c1e73d12369fd9a60fce647e0bec6aa21 Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 02:12:19 +0000 Subject: [PATCH 20/20] Keep cargo test module prefixes and Tailscale peer match text Print the first N :: segments so shardmod::case matches shardmod::case_alpha, and stop putting HostName in display_name so Warp prefixes match shard-peer:. --- command-signatures/src/generators/fig_token.rs | 12 ++++++++---- .../src/generators/output_parsers.rs | 14 ++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/command-signatures/src/generators/fig_token.rs b/command-signatures/src/generators/fig_token.rs index ea45211d..6f20f002 100644 --- a/command-signatures/src/generators/fig_token.rs +++ b/command-signatures/src/generators/fig_token.rs @@ -97,12 +97,16 @@ pub fn cargo_test_list( last_token(tokens) }; let token = if token.starts_with('-') { "" } else { token }; - let depth = token.split("::").filter(|s| !s.is_empty()).count().max(1); - let last = token.split("::").last().unwrap_or(""); + let segments = token.split("::").filter(|s| !s.is_empty()).count(); + let depth = if token.ends_with("::") { + segments + 1 + } else { + segments.max(1) + }; CommandBuilder::single_command(format!( - r#"cargo t -- --list 2>/dev/null | awk '/: test$/ {{ print substr($1, 1, length($1) - 1) }}' | awk -F '::' '{{ print ${depth} }}' | grep -F {query} | sort -u"#, + r#"cargo t -- --list 2>/dev/null | awk '/: test$/ {{ print substr($1, 1, length($1) - 1) }}' | awk -F '::' -v n={depth} '{{ s=$1; for (i=2; i<=n && i<=NF; i++) s=s "::" $i; print s }}' | grep -F {query} | sort -u"#, depth = depth, - query = shell_single_quote(last) + query = shell_single_quote(token) )) } diff --git a/command-signatures/src/generators/output_parsers.rs b/command-signatures/src/generators/output_parsers.rs index 2eb1f3f8..f0ef15e9 100644 --- a/command-signatures/src/generators/output_parsers.rs +++ b/command-signatures/src/generators/output_parsers.rs @@ -1073,10 +1073,16 @@ fn tailscale_peers_with_suffix(output: &str, suffix: &str) -> GeneratorResults { let short = dns.split('.').next().unwrap_or(dns); let host = peer.get("HostName").and_then(Value::as_str).unwrap_or(""); let os = peer.get("OS").and_then(Value::as_str).unwrap_or(""); - Some( - Suggestion::with_description(format!("{short}{suffix}"), os) - .with_display_name(Some(host.to_string())), - ) + let description = match (host.is_empty(), os.is_empty()) { + (true, true) => String::new(), + (false, true) => host.to_string(), + (true, false) => os.to_string(), + (false, false) => format!("{host} ({os})"), + }; + Some(Suggestion::with_description( + format!("{short}{suffix}"), + description, + )) }) .collect_unordered_results(), _ => empty(),