Skip to content

Commit

Permalink
feat: add ls-vars command
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Feb 16, 2024
1 parent 2139c41 commit 9c7238d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/vale/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,15 @@ func runRule(args []string, _ *core.CLIFlags) error {

func printVars(_ []string, _ *core.CLIFlags) error {
tableData := pterm.TableData{
{"Variable", "Description"},
{"Variable", "Description", "Set"},
}

for v, info := range core.ConfigVars {
tableData = append(tableData, []string{pterm.Gray(v), info})
found := pterm.FgGreen.Sprint("✓")
if _, ok := os.LookupEnv(v); !ok {
found = pterm.FgRed.Sprint("✗")
}
tableData = append(tableData, []string{pterm.Gray(v), info, found})
}

return pterm.DefaultTable.WithHasHeader().WithData(tableData).Render()
Expand Down

0 comments on commit 9c7238d

Please sign in to comment.