fix: correct argument handling when setting the --app flag

When setting the `--app` flag, there was a special case for the config plugin. This plugin used to take the `--no-restart` flag as the first argument - and still did until this change - resulting in an invalid call to the plugin subcommands. What is worse is that this functionality carried over to all other plugins as they were rewritten in golang, and thus the issue spread without us knowing.

The fix is to support GNU flag parsing rules, which Golang does not do by default (Because Of Reasons™). Switching to `github.com/spf13/pflag` fixes this issue, and also allows positional arguments to be placed wherever, even in the middle of flags.

Closes #4255
This commit is contained in:
Jose Diaz-Gonzalez
2020-12-19 20:01:15 -05:00
parent 0050aa6b92
commit 8240790381
29 changed files with 87 additions and 16 deletions

View File

@@ -1,13 +1,14 @@
package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/proxy"
flag "github.com/spf13/pflag"
)
// main entrypoint to all subcommands