Skip to content

Commit

Permalink
🧱 renaming cli from vc to vci
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed May 9, 2024
1 parent fe8574e commit c923ac7
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ jobs:
run: go test -race ./...

- name: Build
run: go build -v ./cmd/vc
run: go build -v ./cmd/vci
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/share/fish/vendor_completions.d
/share/man/man1
/share/zsh/site-functions
/vc-cli
/vci-cli
.envrc
/dist
/site
Expand Down
38 changes: 19 additions & 19 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: vc
project_name: vci

release:
prerelease: auto
Expand All @@ -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"}}

Expand All @@ -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"}}

Expand All @@ -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:
Expand All @@ -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"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pkg/cmd/root/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ 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 }}
`)
}

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.
`)
}
8 changes: 4 additions & 4 deletions pkg/cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ func (ae *AuthError) Error() string {
func NewCmdRoot() *cobra.Command {
i18n.Init()
cmd := &cobra.Command{
Use: "vc <command> <subcommand> [flags]",
Use: "vci <command> <subcommand> [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 {

Expand Down
8 changes: 4 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -51,19 +51,19 @@ 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) {
homeDir, err := os.UserHomeDir()
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
Expand Down
20 changes: 10 additions & 10 deletions pkg/i18n/i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",

Expand Down Expand Up @@ -152,21 +152,21 @@ 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",
PurlVulnFound: "1 Vulnerability were found for purl %s",
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",
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

# 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)
Expand Down
8 changes: 4 additions & 4 deletions script/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand All @@ -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")
}
}

Expand Down

0 comments on commit c923ac7

Please sign in to comment.