Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e33c37c82 | ||
|
|
588c1bae74 |
@@ -75,5 +75,7 @@ RUN version="${VERSION:-$(git describe --tags --always)}"; \
|
|||||||
RUN ldd /mfer 2>&1 | grep -q 'not a dynamic executable'
|
RUN ldd /mfer 2>&1 | grep -q 'not a dynamic executable'
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
# scratch has no CA certificates; fetch needs them to verify HTTPS servers.
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
COPY --from=builder /mfer /mfer
|
COPY --from=builder /mfer /mfer
|
||||||
ENTRYPOINT ["/mfer"]
|
ENTRYPOINT ["/mfer"]
|
||||||
|
|||||||
@@ -291,9 +291,9 @@ func TestVerboseCount(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestCombinedShortVerbose asserts that -vv gives debug output wherever -v
|
// TestCombinedShortVerboseRefused asserts that -vv is refused (issue #125):
|
||||||
// is taken, as the -v help text says (issue #125).
|
// single-letter flags do not combine, so the -v help text says -v -v.
|
||||||
func TestCombinedShortVerbose(t *testing.T) {
|
func TestCombinedShortVerboseRefused(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for _, command := range commandsTakingVerbose() {
|
for _, command := range commandsTakingVerbose() {
|
||||||
@@ -303,15 +303,18 @@ func TestCombinedShortVerbose(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
opts := testOpts(args, afero.NewMemMapFs())
|
opts := testOpts(args, afero.NewMemMapFs())
|
||||||
_, level := runCLIWithLevel(opts)
|
exitCode, level := runCLIWithLevel(opts)
|
||||||
assert.Equal(t, log.DebugLevel, level, "stderr: %s", testStderr(t, opts))
|
|
||||||
|
assert.Equal(t, 1, exitCode)
|
||||||
|
assert.Contains(t, testStderr(t, opts), "flag provided but not defined: -vv")
|
||||||
|
assert.Equal(t, log.InfoLevel, level)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestShortAndLongVerboseRefused asserts that -v and --verbose given together
|
// TestShortAndLongVerboseRefused asserts that -v and --verbose given together
|
||||||
// are refused (issue #125): urfave/cli v2 refuses any flag given under two of
|
// are refused (issue #125): urfave/cli v2 refuses a flag given under two of its
|
||||||
// its names, and accepting it would take parsing the arguments by hand.
|
// names, and one flag with an alias keeps help and parsing simple.
|
||||||
func TestShortAndLongVerboseRefused(t *testing.T) {
|
func TestShortAndLongVerboseRefused(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ func commonFlags() []cli.Flag {
|
|||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "verbose",
|
Name: "verbose",
|
||||||
Aliases: []string{"v"},
|
Aliases: []string{"v"},
|
||||||
Usage: "Increase verbosity (-v for verbose, -vv for debug)",
|
Usage: "Increase verbosity (-v for verbose, -v -v for debug)",
|
||||||
Count: new(int),
|
Count: new(int),
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
@@ -328,7 +328,7 @@ func (mfa *CLIApp) fetchCommand() *cli.Command {
|
|||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
Name: cmdFetch,
|
Name: cmdFetch,
|
||||||
Usage: "fetch manifest and referenced files",
|
Usage: "fetch manifest and referenced files",
|
||||||
ArgsUsage: "[URL]",
|
ArgsUsage: "URL",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
mfa.setVerbosity(c)
|
mfa.setVerbosity(c)
|
||||||
mfa.printBanner()
|
mfa.printBanner()
|
||||||
@@ -371,9 +371,6 @@ func (mfa *CLIApp) run(args []string) {
|
|||||||
Usage: "Manifest generator",
|
Usage: "Manifest generator",
|
||||||
Version: mfa.VersionString(),
|
Version: mfa.VersionString(),
|
||||||
EnableBashCompletion: true,
|
EnableBashCompletion: true,
|
||||||
// Lets single-letter flags combine, at the root and in every
|
|
||||||
// subcommand: -vv is -v -v.
|
|
||||||
UseShortOptionHandling: true,
|
|
||||||
Writer: mfa.Stdout,
|
Writer: mfa.Stdout,
|
||||||
ErrWriter: mfa.Stderr,
|
ErrWriter: mfa.Stderr,
|
||||||
Flags: commonFlags(),
|
Flags: commonFlags(),
|
||||||
|
|||||||
Reference in New Issue
Block a user