From e9d8b19d4dbe46807f0599ed1a49f69309e7dd30 Mon Sep 17 00:00:00 2001 From: Yiheng Li Date: Sat, 21 May 2022 11:19:17 +0800 Subject: [PATCH] feat: add search terms to network (#5602) Co-authored-by: Leyoh Li --- crates/nu-command/src/network/fetch.rs | 4 ++++ crates/nu-command/src/network/post.rs | 4 ++++ crates/nu-command/src/network/url/host.rs | 4 ++++ crates/nu-command/src/network/url/path.rs | 4 ++++ crates/nu-command/src/network/url/query.rs | 4 ++++ crates/nu-command/src/network/url/scheme.rs | 4 ++++ crates/nu-command/src/network/url/url_.rs | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/crates/nu-command/src/network/fetch.rs b/crates/nu-command/src/network/fetch.rs index 3a4b0e582e..9a4926dcf1 100644 --- a/crates/nu-command/src/network/fetch.rs +++ b/crates/nu-command/src/network/fetch.rs @@ -75,6 +75,10 @@ impl Command for SubCommand { "Performs HTTP GET operation." } + fn search_terms(&self) -> Vec<&str> { + vec!["network", "fetch", "get", "pull", "request", "http"] + } + fn run( &self, engine_state: &EngineState, diff --git a/crates/nu-command/src/network/post.rs b/crates/nu-command/src/network/post.rs index 5c92b8f833..3cb87386e6 100644 --- a/crates/nu-command/src/network/post.rs +++ b/crates/nu-command/src/network/post.rs @@ -79,6 +79,10 @@ impl Command for SubCommand { "Performs HTTP POST operation." } + fn search_terms(&self) -> Vec<&str> { + vec!["network", "post", "send", "push", "http"] + } + fn run( &self, engine_state: &EngineState, diff --git a/crates/nu-command/src/network/url/host.rs b/crates/nu-command/src/network/url/host.rs index 17192b6184..53ca10546b 100644 --- a/crates/nu-command/src/network/url/host.rs +++ b/crates/nu-command/src/network/url/host.rs @@ -25,6 +25,10 @@ impl Command for SubCommand { "Get the host of a URL" } + fn search_terms(&self) -> Vec<&str> { + vec!["url", "host", "hostname"] + } + fn run( &self, engine_state: &EngineState, diff --git a/crates/nu-command/src/network/url/path.rs b/crates/nu-command/src/network/url/path.rs index a6bf7a000d..8e7e896ee5 100644 --- a/crates/nu-command/src/network/url/path.rs +++ b/crates/nu-command/src/network/url/path.rs @@ -25,6 +25,10 @@ impl Command for SubCommand { "Get the path of a URL" } + fn search_terms(&self) -> Vec<&str> { + vec!["url", "path"] + } + fn run( &self, engine_state: &EngineState, diff --git a/crates/nu-command/src/network/url/query.rs b/crates/nu-command/src/network/url/query.rs index c4755bdaa3..8ffbad8dc0 100644 --- a/crates/nu-command/src/network/url/query.rs +++ b/crates/nu-command/src/network/url/query.rs @@ -25,6 +25,10 @@ impl Command for SubCommand { "Get the query string of a URL" } + fn search_terms(&self) -> Vec<&str> { + vec!["url", "query", "parameter"] + } + fn run( &self, engine_state: &EngineState, diff --git a/crates/nu-command/src/network/url/scheme.rs b/crates/nu-command/src/network/url/scheme.rs index 2dd1d235d8..729a5e042f 100644 --- a/crates/nu-command/src/network/url/scheme.rs +++ b/crates/nu-command/src/network/url/scheme.rs @@ -25,6 +25,10 @@ impl Command for SubCommand { "Get the scheme (e.g. http, file) of a URL" } + fn search_terms(&self) -> Vec<&str> { + vec!["url", "scheme", "protocol"] + } + fn run( &self, engine_state: &EngineState, diff --git a/crates/nu-command/src/network/url/url_.rs b/crates/nu-command/src/network/url/url_.rs index 52ba716079..7bad2e1587 100644 --- a/crates/nu-command/src/network/url/url_.rs +++ b/crates/nu-command/src/network/url/url_.rs @@ -21,6 +21,10 @@ impl Command for Url { "Apply url function." } + fn search_terms(&self) -> Vec<&str> { + vec!["url", "network", "parse"] + } + fn run( &self, engine_state: &EngineState,