Skip to content

Commit 707d3bb

Browse files
authored
Merge pull request #14 from bcmi-labs/distribution
Distribution
2 parents 29eb98e + 5b8cd04 commit 707d3bb

22 files changed

+871
-914
lines changed

.vscode/launch.json

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
5+
{
6+
"name": "Launch no args",
7+
"type": "go",
8+
"request": "launch",
9+
"mode": "debug",
10+
"program": "${workspaceRoot}/main.go",
11+
"showLog": true
12+
},
13+
{
14+
"name": "Launch LIB no args",
15+
"type": "go",
16+
"request": "launch",
17+
"mode": "debug",
18+
"program": "${workspaceRoot}/main.go",
19+
"env": {},
20+
"args": ["lib"],
21+
"showLog": true
22+
},
23+
{
24+
"name": "Launch LIB LIST",
25+
"type": "go",
26+
"request": "launch",
27+
"mode": "debug",
28+
"program": "${workspaceRoot}/main.go",
29+
"env": {},
30+
"args": ["lib", "list"],
31+
"showLog": true
32+
},
33+
{
34+
"name": "Launch LIB LIST UPDATE",
35+
"type": "go",
36+
"request": "launch",
37+
"mode": "debug",
38+
"program": "${workspaceRoot}/main.go",
39+
"env": {},
40+
"args": ["lib", "list", "update", "-v"],
41+
"showLog": true
42+
},
43+
{
44+
"name": "Launch LIB INSTALL",
45+
"type": "go",
46+
"request": "launch",
47+
"mode": "debug",
48+
"program": "${workspaceRoot}/main.go",
49+
"env": {},
50+
"args": ["lib", "install", "YoutubeApi"],
51+
"showLog": true
52+
}
53+
]
54+
}

.vscode/settings.json

-3
This file was deleted.

cmd/root.go renamed to cmd/arduino.go

+20-6
Original file line numberDiff line numberDiff line change
@@ -77,29 +77,43 @@ var rootCmdFlags struct {
7777
ConfigFile string
7878
}
7979

80-
// RootCmd represents the base command when called without any subcommands
81-
var RootCmd = &cobra.Command{
80+
// arduinoCmd represents the base command when called without any subcommands
81+
var arduinoCmd = &cobra.Command{
8282
Use: "arduino",
8383
Short: "Arduino CLI",
8484
Long: "Arduino Create Command Line Interface (arduino-cli)",
8585
BashCompletionFunction: bashAutoCompletionFunction,
8686
}
8787

88+
// arduinoVersionCmd represents the version command.
89+
var arduinoVersionCmd = &cobra.Command{
90+
Use: "version",
91+
Short: "Shows version Number of arduino",
92+
Long: `Shows version Number of arduino which is installed on your system.`,
93+
Run: func(cmd *cobra.Command, args []string) {
94+
fmt.Printf("arduino V. %s\n", ArduinoVersion)
95+
if GlobalFlags.Verbose > 0 {
96+
fmt.Printf("arduino V. %s\n", LibVersion)
97+
}
98+
},
99+
}
100+
88101
// Execute adds all child commands to the root command sets flags appropriately.
89102
// This is called by main.main(). It only needs to happen once to the rootCmd.
90103
func Execute() {
91-
if err := RootCmd.Execute(); err != nil {
92-
//fmt.Println(err)
104+
err := arduinoCmd.Execute()
105+
if err != nil {
93106
os.Exit(1)
94107
}
95108
}
96109

97110
func init() {
98111
cobra.OnInitialize(initConfig)
99112

100-
RootCmd.PersistentFlags().CountVarP(&GlobalFlags.Verbose, "verbose", "v", "enables verbose output (use more times for a higher level)")
113+
arduinoCmd.PersistentFlags().CountVarP(&GlobalFlags.Verbose, "verbose", "v", "enables verbose output (use more times for a higher level)")
114+
arduinoCmd.Flags().StringVar(&rootCmdFlags.ConfigFile, "config", "", "config file (default is $HOME/.arduino-cli.yaml)")
101115

102-
RootCmd.Flags().StringVar(&rootCmdFlags.ConfigFile, "config", "", "config file (default is $HOME/.arduino-cli.yaml)")
116+
arduinoCmd.AddCommand(arduinoVersionCmd)
103117
}
104118

105119
// initConfig reads in config file and ENV variables if set.

0 commit comments

Comments
 (0)