feat: initial commit
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
This commit is contained in:
34
internal/command/api/inbound/flag/flag.go
Normal file
34
internal/command/api/inbound/flag/flag.go
Normal file
@ -0,0 +1,34 @@
|
||||
package flag
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
clientFlag "forge.cadoles.com/cadoles/bouncer/internal/command/api/flag"
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/datastore"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func WithInboundFlags(flags ...cli.Flag) []cli.Flag {
|
||||
baseFlags := clientFlag.ComposeFlags(
|
||||
&cli.StringFlag{
|
||||
Name: "inbound-id",
|
||||
Aliases: []string{"in"},
|
||||
Usage: "use `INBOUND_ID` as selected inbound",
|
||||
Value: "",
|
||||
},
|
||||
)
|
||||
|
||||
flags = append(flags, baseFlags...)
|
||||
|
||||
return flags
|
||||
}
|
||||
|
||||
func AssertInboundID(ctx *cli.Context) (datastore.InboundID, error) {
|
||||
rawInboundID := ctx.String("inbound-id")
|
||||
|
||||
if rawInboundID == "" {
|
||||
return "", errors.New("flag 'inbound-id' is required")
|
||||
}
|
||||
|
||||
return datastore.InboundID(rawInboundID), nil
|
||||
}
|
13
internal/command/api/inbound/root.go
Normal file
13
internal/command/api/inbound/root.go
Normal file
@ -0,0 +1,13 @@
|
||||
package inbound
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func Root() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "agent",
|
||||
Usage: "Inbounds related commands",
|
||||
Subcommands: []*cli.Command{},
|
||||
}
|
||||
}
|
17
internal/command/api/inbound/util.go
Normal file
17
internal/command/api/inbound/util.go
Normal file
@ -0,0 +1,17 @@
|
||||
package inbound
|
||||
|
||||
import "forge.cadoles.com/cadoles/bouncer/internal/format"
|
||||
|
||||
func agentHints(outputMode format.OutputMode) format.Hints {
|
||||
return format.Hints{
|
||||
OutputMode: outputMode,
|
||||
Props: []format.Prop{
|
||||
format.NewProp("ID", "ID"),
|
||||
format.NewProp("Label", "Label"),
|
||||
format.NewProp("Thumbprint", "Thumbprint"),
|
||||
format.NewProp("Status", "Status"),
|
||||
format.NewProp("ContactedAt", "ContactedAt"),
|
||||
format.NewProp("UpdatedAt", "UpdatedAt"),
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user