Documentation
¶
Overview ¶
Package marshal provides a representation of the command line model in a serializable data model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisallowUnknownFields ¶ added in v0.14.1
DisallowUnknownFields affects unmarshaling and prevents unknown fields from being specified.
func From ¶
From creates the schema serialization value for the given Joe value. The following types are supported:
- *cli.App
- *cli.Arg
- *cli.Command
- *cli.Flag
Any other type of value specified will panic
func RegisterCodec ¶ added in v0.14.1
RegisterCodec provides the behavior of registering a codec. This is expected to be called by implementations in their package initializer
Types ¶
type App ¶
type App struct {
Name string `json:"name"`
Commands []Command `json:"commands,omitempty"`
Flags []Flag `json:"flags,omitempty"`
Args []Arg `json:"args,omitempty"`
HelpText string `json:"helpText,omitempty"`
ManualText string `json:"manualText,omitempty"`
UsageText string `json:"usageText,omitempty"`
Version string `json:"version,omitempty"`
BuildDate time.Time `json:"buildDate"`
Author string `json:"author,omitempty"`
Copyright string `json:"copyright,omitempty"`
License string `json:"license,omitempty"`
Comment string `json:"comment,omitempty"`
Options Options `json:"options,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
type Arg ¶
type Arg struct {
Name string `json:"name"`
EnvVars []string `json:"envVars,omitempty"`
FilePath string `json:"filePath,omitempty"`
HelpText string `json:"helpText,omitempty"`
ManualText string `json:"manualText,omitempty"`
Category string `json:"category,omitempty"`
UsageText string `json:"usageText,omitempty"`
DefaultText string `json:"defaultText,omitempty"`
Options Options `json:"options,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
type Codec ¶ added in v0.14.1
type Codec int
Codec identifies the support codecs. The JSON codec is supported by default. To add support for additional codecs, you must import them or register them. For example,
import _ "github.com/Carbonfrost/joe-cli/extensions/marshal/codec/toml"
type Command ¶
type Command struct {
Name string `json:"name"`
Aliases []string `json:"aliases,omitempty"`
Subcommands []Command `json:"subcommands,omitempty"`
Flags []Flag `json:"flags,omitempty"`
Args []Arg `json:"args,omitempty"`
HelpText string `json:"helpText,omitempty"`
ManualText string `json:"manualText,omitempty"`
UsageText string `json:"usageText,omitempty"`
Comment string `json:"comment,omitempty"`
Category string `json:"category,omitempty"`
Options Options `json:"options,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
type Flag ¶
type Flag struct {
Name string `json:"name"`
Aliases []string `json:"aliases,omitempty"`
EnvVars []string `json:"envVars,omitempty"`
FilePath string `json:"filePath,omitempty"`
HelpText string `json:"helpText,omitempty"`
ManualText string `json:"manualText,omitempty"`
Category string `json:"category,omitempty"`
UsageText string `json:"usageText,omitempty"`
DefaultText string `json:"defaultText,omitempty"`
Options Options `json:"options,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option specifies an option for creating marshal values
func WithPrivateData ¶ added in v0.10.0
func WithPrivateData() Option
WithPrivateData provides an option that causes private data, which is any data added to a Data map whose key starts with understcore, is included in the marshal representation of a target. By default, private data is excluded
type Type ¶
type Type int
Type identifies the built-in supported types
const ( UnknownType Type = iota BigFloat BigInt Bool Bytes Duration File FileSet Float32 Float64 Int Int16 Int32 Int64 Int8 IP List Map NameValue NameValues Regexp String Uint Uint16 Uint32 Uint64 Uint8 URL )
The various types that the CLI supports
func (Type) MarshalText ¶
MarshalText provides the textual representation
func (*Type) UnmarshalText ¶
UnmarshalText converts the textual representation