-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to wavesoftware/commandline package (#205)
- Loading branch information
Showing
77 changed files
with
2,595 additions
and
745 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,15 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"os" | ||
|
||
"go.uber.org/zap" | ||
"knative.dev/kn-plugin-event/pkg/cli/retcode" | ||
"knative.dev/kn-plugin-event/pkg/configuration" | ||
"knative.dev/pkg/logging" | ||
"github.com/wavesoftware/go-commandline" | ||
"knative.dev/kn-plugin-event/internal/ics" | ||
) | ||
|
||
// ExitFunc will be used to exit Go process in case of error. | ||
var ExitFunc = os.Exit // nolint:gochecknoglobals | ||
|
||
func main() { | ||
logger := createLogger() | ||
app := configuration.CreateIcs() | ||
if err := app.SendFromEnv(); err != nil { | ||
logger.Error(err) | ||
ExitFunc(retcode.Calc(err)) | ||
} | ||
commandline.New(ics.App{}).ExecuteOrDie(ics.Options...) | ||
} | ||
|
||
// TestMain is used by tests. | ||
//goland:noinspection GoUnusedExportedFunction | ||
func TestMain() { //nolint:deadcode | ||
main() | ||
} | ||
|
||
func createLogger() *zap.SugaredLogger { | ||
return logging. | ||
FromContext(context.TODO()). | ||
With("env", os.Environ()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package main | ||
|
||
import "knative.dev/kn-plugin-event/internal/cli/cmd" | ||
|
||
// Suppress global check for testing purposes. | ||
var mainCmd = &cmd.Cmd{} //nolint:gochecknoglobals | ||
import ( | ||
"github.com/wavesoftware/go-commandline" | ||
"knative.dev/kn-plugin-event/internal/cli/cmd" | ||
) | ||
|
||
func main() { | ||
mainCmd.Execute() | ||
commandline.New(new(cmd.App)).ExecuteOrDie(cmd.Options...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.