Conditions | 4 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package main |
||
12 | func main() { |
||
13 | |||
14 | // Extract command to run |
||
15 | cmd, args := internal.ParseArgs(os.Args) |
||
16 | |||
17 | // Execute command |
||
18 | output, err := exec.Command(cmd, args...).CombinedOutput() |
||
19 | |||
20 | if err != nil { |
||
21 | if len(output) == 0 { |
||
22 | fmt.Printf("Command not found %s\n", cmd) |
||
23 | os.Exit(1) |
||
24 | } |
||
25 | if browser.OpenURL(internal.GetSearchUrl(output)) != nil { |
||
26 | fmt.Println("Unable to open brower. Is one installed?") |
||
27 | } |
||
28 | } |
||
29 | |||
30 | // Flush command output |
||
31 | fmt.Printf("%s", output) |
||
32 | } |
||
33 |