cli/cmd/ghcs/main.go
Issy Long 2f8d00e0f8 Merge pull request #19 from github/version-cmd
cmd/ghcs/main: Add `--version` flag
2021-07-20 13:02:41 +01:00

35 lines
597 B
Go

package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
// ghcs create
// ghcs connect
// ghcs delete
// ghcs list
func main() {
Execute()
}
var rootCmd = &cobra.Command{
Use: "ghcs",
Short: "Codespaces",
Long: "Codespaces",
Version: "0.5.0",
}
func Execute() {
if os.Getenv("GITHUB_TOKEN") == "" {
fmt.Println("The GITHUB_TOKEN environment variable is required. Create a Personal Access Token with org SSO access at https://github.com/settings/tokens/new.")
os.Exit(1)
}
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}