github.com/krzko/gosh@v0.0.0-20241128233202-5abd4ef06633/internal/shell/builtins/https.go (about) 1 // internal/shell/builtins/https.go 2 package builtins 3 4 import ( 5 "fmt" 6 ) 7 8 // HttpsCommand represents the 'https' builtin command. 9 type HttpsCommand struct{} 10 11 // Execute performs an HTTPS GET request to the specified URL. 12 // Usage: https [URL] 13 func (c *HttpsCommand) Execute(args []string) error { 14 if len(args) == 0 { 15 return fmt.Errorf("URL required") 16 } 17 18 rawURL := args[0] 19 if err := executeRequest(rawURL, "https"); err != nil { 20 return err 21 } 22 23 return nil 24 } 25 26 // Help returns the help message for the 'https' command. 27 func (c *HttpsCommand) Help() string { 28 return `https: Transfer data from a URL using HTTPS 29 Usage: https [URL] 30 31 If the scheme (https://) is omitted, 'https://' is assumed.` 32 }