diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22e8283..68dd8bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,4 +60,4 @@ jobs: run: go test -race ./... - name: Build - run: go build -v ./cmd/vc + run: go build -v ./cmd/vci diff --git a/.gitignore b/.gitignore index 8c53fa5..a1e6f01 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ /share/fish/vendor_completions.d /share/man/man1 /share/zsh/site-functions -/vc-cli +/vci-cli .envrc /dist /site diff --git a/.goreleaser.yml b/.goreleaser.yml index 859babe..e91bb42 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,4 +1,4 @@ -project_name: vc +project_name: vci release: prerelease: auto @@ -20,8 +20,8 @@ builds: post: - cmd: ./script/sign '{{ .Path }}' output: true - binary: bin/vc - main: ./cmd/vc + binary: bin/vci + main: ./cmd/vci ldflags: - -s -w -X github.com/vulncheck-oss/cli/internal/build.Version={{.Version}} -X github.com/vulncheck-oss/cli/internal/build.Date={{time "2006-01-02"}} @@ -30,8 +30,8 @@ builds: goarch: [386, arm, amd64, arm64] env: - CGO_ENABLED=0 - binary: bin/vc - main: ./cmd/vc + binary: bin/vci + main: ./cmd/vci ldflags: - -s -w -X github.com/vulncheck-oss/cli/internal/build.Version={{.Version}} -X github.com/vulncheck-oss/cli/internal/build.Date={{time "2006-01-02"}} @@ -43,31 +43,31 @@ builds: - cmd: >- {{ if eq .Runtime.Goos "windows" }}pwsh .\script\sign.ps1{{ else }}./script/sign{{ end }} '{{ .Path }}' output: true - binary: bin/vc - main: ./cmd/vc + binary: bin/vci + main: ./cmd/vci ldflags: - -s -w -X github.com/vulncheck-oss/cli/internal/build.Version={{.Version}} -X github.com/vulncheck-oss/cli/internal/build.Date={{time "2006-01-02"}} archives: - id: linux-archive builds: [linux] - name_template: "vc_{{ .Version }}_linux_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + name_template: "vci_{{ .Version }}_linux_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" wrap_in_directory: true format: tar.gz files: - LICENSE - - ./share/man/man1/vc*.1 + - ./share/man/man1/vci*.1 - id: macos-archive builds: [macos] - name_template: "vc_{{ .Version }}_macOS_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + name_template: "vci_{{ .Version }}_macOS_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" wrap_in_directory: true format: zip files: - LICENSE - - ./share/man/man1/vc*.1 + - ./share/man/man1/vci*.1 - id: windows-archive builds: [windows] - name_template: "vc_{{ .Version }}_windows_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + name_template: "vci_{{ .Version }}_windows_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" wrap_in_directory: false format: zip files: @@ -85,11 +85,11 @@ nfpms: #build:linux - deb - rpm contents: - - src: "./share/man/man1/vc*.1" + - src: "./share/man/man1/vci*.1" dst: "/usr/share/man/man1" - - src: "./share/bash-completion/completions/vc" - dst: "/usr/share/bash-completion/completions/vc" - - src: "./share/fish/vendor_completions.d/vc.fish" - dst: "/usr/share/fish/vendor_completions.d/vc.fish" - - src: "./share/zsh/site-functions/_vc" - dst: "/usr/share/zsh/site-functions/_vc" + - src: "./share/bash-completion/completions/vci" + dst: "/usr/share/bash-completion/completions/vci" + - src: "./share/fish/vendor_completions.d/vci.fish" + dst: "/usr/share/fish/vendor_completions.d/vci.fish" + - src: "./share/zsh/site-functions/_vci" + dst: "/usr/share/zsh/site-functions/_vci" diff --git a/Makefile b/Makefile index a4d8eb3..22c37b7 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,8 @@ endif ## The following tasks delegate to `script/build.go` so they can be run cross-platform. -.PHONY: bin/vc$(EXE) -bin/vc$(EXE): script/build$(EXE) +.PHONY: bin/vci$(EXE) +bin/vci$(EXE): script/build$(EXE) @script/build$(EXE) $@ script/build$(EXE): script/build.go diff --git a/cmd/vc/main.go b/cmd/vci/main.go similarity index 100% rename from cmd/vc/main.go rename to cmd/vci/main.go diff --git a/pkg/cmd/root/help.go b/pkg/cmd/root/help.go index 6c81ef2..820c5e7 100644 --- a/pkg/cmd/root/help.go +++ b/pkg/cmd/root/help.go @@ -8,7 +8,7 @@ import ( func authHelp() string { if os.Getenv("GITHUB_ACTIONS") == "true" { return heredoc.Doc(` - vc: To use VulnCheck CLI in a GitHub Actions workflow, set the VC_TOKEN environment variable. Example: + vci: To use VulnCheck CLI in a GitHub Actions workflow, set the VC_TOKEN environment variable. Example: env: VC_TOKEN: ${{ secrets.VC_TOKEN }} `) @@ -16,12 +16,12 @@ func authHelp() string { if os.Getenv("CI") != "" { return heredoc.Doc(` - vc: To use VulnCheck CLI in automation, set the VC_TOKEN environment variable. + vci: To use VulnCheck CLI in automation, set the VC_TOKEN environment variable. `) } return heredoc.Doc(` - To get started with VulnCheck CLI, please run: vc auth login + To get started with VulnCheck CLI, please run: vci auth login Alternatively, populate the VC_TOKEN environment variable with a VulnCheck token acquired from the portal at https://vulncheck.com/token. `) } diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 9710b8c..a521dfe 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -35,13 +35,13 @@ func (ae *AuthError) Error() string { func NewCmdRoot() *cobra.Command { i18n.Init() cmd := &cobra.Command{ - Use: "vc [flags]", + Use: "vci [flags]", Short: "VulnCheck CLI.", Long: i18n.C.RootLong, Example: heredoc.Doc(` - $ vc indices list - $ vc index abb - $ vc backup abb + $ vci indices list + $ vci index abb + $ vci backup abb `), PersistentPreRunE: func(cmd *cobra.Command, args []string) error { diff --git a/pkg/config/config.go b/pkg/config/config.go index 8ac7100..7bbc0ef 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -30,7 +30,7 @@ func loadConfig() (*Config, error) { } viper.AddConfigPath(dir) - viper.SetConfigName("vc") + viper.SetConfigName("vci") viper.SetConfigType("yaml") err = viper.ReadInConfig() if err != nil { @@ -51,11 +51,11 @@ func saveConfig(config *Config) error { return err } viper.AddConfigPath(dir) - viper.SetConfigName("vc") + viper.SetConfigName("vci") viper.SetConfigPermissions(0600) viper.SetConfigType("yaml") viper.Set("Token", config.Token) - return viper.WriteConfigAs(fmt.Sprintf("%s/vc.yaml", dir)) + return viper.WriteConfigAs(fmt.Sprintf("%s/vci.yaml", dir)) } func configDir() (string, error) { @@ -63,7 +63,7 @@ func configDir() (string, error) { if err != nil { return "", nil } - dir := fmt.Sprintf("%s/.config/vc", homeDir) + dir := fmt.Sprintf("%s/.config/vci", homeDir) if _, err := os.Stat(dir); os.IsNotExist(err) { if err := os.MkdirAll(dir, 0755); err != nil { return "", err diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index 027f823..7d7e82d 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -92,7 +92,7 @@ var En = Copy{ InteractiveOnly: "This command is interactive and cannot run in a CI environment, please try %s instead", RootLong: "Work seamlessly with the VulnCheck API.", - AuthShort: "Authenticate vc with the VulnCheck portal", + AuthShort: "Authenticate vci with the VulnCheck portal", AuthStatusShort: "Check authentication status", AuthStatusLong: "Check if you're currently authenticated and if so, display the account information", AuthLoginShort: "Authenticate with the VulnCheck portal", @@ -103,15 +103,15 @@ var En = Copy{ Alternatively, use %[1]stoken%[1]s to specify an issued token directly. - Alternatively, vc will use the authentication token found in the %[1]sVC_TOKEN%[1]s environment variable. - This method is most suitable for "headless" use of vc such as in automation. + Alternatively, vci will use the authentication token found in the %[1]sVC_TOKEN%[1]s environment variable. + This method is most suitable for "headless" use of vci such as in automation. `, "`"), AuthLoginExample: heredoc.Doc(` # Start interactive authentication - $ vc auth login + $ vci auth login # Authenticate with vulncheck.com by passing in a token - $ vc auth login token vulncheck_****************** + $ vci auth login token vulncheck_****************** `), AuthLoginErrorCI: "This command is interactive and cannot be run in a CI environment, use the VC_TOKEN environment variable instead", @@ -152,13 +152,13 @@ var En = Copy{ BackupDownloadComplete: "Backup downloaded successfully", CpeShort: "Look up a specified cpe for any related CVEs", - CpeExample: "vc cpe \"%s\"", + CpeExample: "vci cpe \"%s\"", CpeNoCves: "No CVEs were found for cpe %s", CpeCvesFound: "%d CVEs were found for cpe %s", CpeErrorSchemeRequired: "cpe scheme is required", PurlShort: "Look up a specified PURL for any CVES or vulnerabilities", - PurlExample: "vc purl \"%s\"", + PurlExample: "vci purl \"%s\"", PurlErrorSchemeRequired: "purl scheme is required", PurlNoVulns: "No Vulnerabilities were found for purl %s", @@ -166,7 +166,7 @@ var En = Copy{ PurlVulnsFound: "%d Vulnerabilities were found for purl %s", ScanShort: "Scan a directory for vulnerabilities", - ScanExample: "vc scan /path/to/directory", + ScanExample: "vci scan /path/to/directory", ScanSbomStart: "Generating SBOM", ScanSbomEnd: "SBOM created", @@ -183,8 +183,8 @@ var En = Copy{ ScanBenchmark: "Scan completed in %s", ScanErrorDirectoryRequired: "Error: Directory is required", - ErrorUnauthorized: "Error: Unauthorized, Try authenticating with: vc auth login", - ErrorNoToken: "No token found. Please run `vc auth login` to authenticate or populate the environment variable `VC_TOKEN`.", + ErrorUnauthorized: "Error: Unauthorized, Try authenticating with: vci auth login", + ErrorNoToken: "No token found. Please run `vci auth login` to authenticate or populate the environment variable `VC_TOKEN`.", } func Init() { diff --git a/pkg/session/session.go b/pkg/session/session.go index 055a1a9..27d7f58 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -50,7 +50,7 @@ func VersionFormat(version, buildDate string) string { dateStr = fmt.Sprintf(" (%s)", buildDate) } - return fmt.Sprintf("vc version %s%s\n%s\n", version, dateStr, ChangelogURL(version)) + return fmt.Sprintf("vci version %s%s\n%s\n", version, dateStr, ChangelogURL(version)) } func Connect(token string) *sdk.Client { diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 07e970b..4a50187 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -5,7 +5,7 @@ import ( ) func TestVersionFormat(t *testing.T) { - expects := "vc version 1.4.0 (2020-12-15)\nhttps://github.com/vulncheck-oss/cli/releases/tag/v1.4.0\n" + expects := "vci version 1.4.0 (2020-12-15)\nhttps://github.com/vulncheck-oss/cli/releases/tag/v1.4.0\n" if got := VersionFormat("1.4.0", "2020-12-15"); got != expects { t.Errorf("Format() = %q, wants %q", got, expects) } diff --git a/readme.md b/readme.md index 325706f..29168c3 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@

# The VulnCheck CLI -`vc` is access to the VulnCheck API on the command line. It brings index browsing, backup management, and vulnerability scanning to the terminal. +`vci` is access to the VulnCheck API on the command line. It brings index browsing, backup management, and vulnerability scanning to the terminal. [![Release](https://img.shields.io/github/v/release/vulncheck-oss/cli)](https://github.com/vulncheck-oss/cli/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/vulncheck-oss/cli)](https://goreportcard.com/report/github.com/vulncheck-oss/cli) diff --git a/script/build.go b/script/build.go index 8297048..002e3af 100644 --- a/script/build.go +++ b/script/build.go @@ -35,12 +35,12 @@ import ( ) var tasks = map[string]func(string) error{ - "bin/vc": func(exe string) error { + "bin/vci": func(exe string) error { ldflags := os.Getenv("GO_LDFLAGS") ldflags = fmt.Sprintf("-X github.com/vulncheck-oss/cli/pkg/build.Version=%s %s", version(), ldflags) ldflags = fmt.Sprintf("-X github.com/vulncheck-oss/cli/pkg/build.Date=%s %s", date(), ldflags) - return run("go", "build", "-trimpath", "-ldflags", ldflags, "-o", exe, "./cmd/vc") + return run("go", "build", "-trimpath", "-ldflags", ldflags, "-o", exe, "./cmd/vci") }, "manpages": func(_ string) error { return run("go", "run", "./cmd/gen-docs", "--man-page", "--doc-path", "./share/man/man1/") @@ -64,9 +64,9 @@ func main() { if len(args) < 2 { if isWindowsTarget() { - args = append(args, filepath.Join("bin", "vc.exe")) + args = append(args, filepath.Join("bin", "vci.exe")) } else { - args = append(args, "bin/vc") + args = append(args, "bin/vci") } }