Commit 7997cd0d
7997cd0d48d3Merged
Dmitriy Zhilyaev <[email protected]> · 2 years ago · 10 files · +4 added · ~6 modified
Description
Merge pull request #946 from helmwave/flags-refactoring
Flags refactoring
Details
- Commit
- 7997cd0d48d3
- Parent
- 13c1ab232b21
- Merge parent
- db6822bcfb19
cmd/helmwave/commands.goaddedView file
1+
package main2+
3+
import (4+
"fmt"5+
"github.com/helmwave/helmwave/pkg/action"6+
helmwave "github.com/helmwave/helmwave/pkg/version"7+
"github.com/urfave/cli/v2"8+
)9+
10+
// commands is a registration list for commands11+
var commands = []*cli.Command{12+
new(action.Build).Cmd(),13+
new(action.Diff).Cmd(),14+
new(action.Up).Cmd(),15+
new(action.List).Cmd(),16+
new(action.Rollback).Cmd(),17+
new(action.Status).Cmd(),18+
new(action.Down).Cmd(),19+
new(action.Validate).Cmd(),20+
new(action.Yml).Cmd(),21+
new(action.GenSchema).Cmd(),22+
new(action.Graph).Cmd(),23+
version(),24+
completion(),25+
}26+
27+
func version() *cli.Command {28+
return &cli.Command{29+
Name: "version",30+
Aliases: []string{"ver"},31+
Category: action.Step_,32+
Usage: "show shorts version",33+
Action: func(c *cli.Context) error {34+
fmt.Println(helmwave.Version) //nolint:forbidigo // we need to use fmt.Println here35+
36+
return nil37+
},38+
}39+
}40+
41+
// CommandNotFoundError is return when CLI command is not found.42+
type CommandNotFoundError struct {43+
Command string44+
}45+
46+
func (e CommandNotFoundError) Error() string {47+
return fmt.Sprintf("👻 Command %q not found", e.Command)48+
}49+
50+
func command404(_ *cli.Context, s string) {51+
err := CommandNotFoundError{52+
Command: s,53+
}54+
panic(err)55+
}cmd/helmwave/main.gomodifiedView file
Loading diff…
pkg/action/build.gomodifiedView file
Loading diff…
pkg/action/build_internal_test.gomodifiedView file
Loading diff…
pkg/action/flags.gomodifiedView file
Loading diff…
pkg/action/flags_diff.goaddedView file
Loading diff…
pkg/action/flags_kubedog.goaddedView file
Loading diff…
pkg/action/flags_selection.goaddedView file
Loading diff…
pkg/cache/config.gomodifiedView file
Loading diff…
pkg/cache/config_test.gomodifiedView file
Loading diff…