nu_command/network/http/
http_.rs

1use nu_engine::{command_prelude::*, get_full_help};
2
3#[derive(Clone)]
4pub struct Http;
5
6impl Command for Http {
7    fn name(&self) -> &str {
8        "http"
9    }
10
11    fn signature(&self) -> Signature {
12        Signature::build("http")
13            .input_output_types(vec![(Type::Nothing, Type::String)])
14            .category(Category::Network)
15    }
16
17    fn description(&self) -> &str {
18        "Various commands for working with http methods."
19    }
20
21    fn extra_description(&self) -> &str {
22        "You must use one of the following subcommands. Using this command as-is will only produce this help message."
23    }
24
25    fn search_terms(&self) -> Vec<&str> {
26        vec![
27            "network", "fetch", "pull", "request", "download", "curl", "wget",
28        ]
29    }
30
31    fn run(
32        &self,
33        engine_state: &EngineState,
34        stack: &mut Stack,
35        call: &Call,
36        _input: PipelineData,
37    ) -> Result<PipelineData, ShellError> {
38        Ok(Value::string(get_full_help(self, engine_state, stack), call.head).into_pipeline_data())
39    }
40}