Documentation ¶
Overview ¶
Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx> SPDX-License-Identifier: Apache-2.0
Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx> SPDX-License-Identifier: Apache-2.0
Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx> SPDX-License-Identifier: Apache-2.0
Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx> SPDX-License-Identifier: Apache-2.0
Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx> SPDX-License-Identifier: Apache-2.0
Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx> SPDX-License-Identifier: Apache-2.0
Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx> SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func AutocompleteKeys(cmd *command.Command, currentValue, config string) ([]string, cobra.ShellCompDirective, error)
- func AutocompleteKeysAndParents(cmd *command.Command, currentValue string, config string) (values []string, flag cobra.ShellCompDirective, err error)
- func KeysFromYAML(data []byte) ([]string, error)
- func VaultAndNameFrom(path string, buf []byte) (name string, vault string, err error)
- type Config
- func (cfg *Config) AsFile(path string, modes ...OutputMode) error
- func (cfg *Config) AsJSON(redacted bool, item bool) ([]byte, error)
- func (cfg *Config) AsYAML(modes ...OutputMode) ([]byte, error)
- func (cfg *Config) Delete(path []string) error
- func (cfg *Config) DiffRemote(path string, redacted, asFetch bool, stdout, stderr io.Writer) error
- func (cfg *Config) MarshalYAML() (any, error)
- func (cfg *Config) Merge(other *Config) error
- func (cfg *Config) OPURL() string
- func (cfg *Config) Set(path []string, data []byte, isSecret, parseEntry bool) error
- func (cfg *Config) ToMap(modes ...OutputMode) map[string]any
- func (cfg *Config) ToOP() *op.Item
- type Entry
- func (e *Entry) AsMap() any
- func (e *Entry) ChildNamed(name string) *Entry
- func (e *Entry) Contents() []*Entry
- func (e *Entry) FromOP(fields []*op.ItemField) error
- func (e *Entry) IsScalar() bool
- func (e *Entry) IsSecret() bool
- func (e *Entry) MarshalYAML() (*yaml.Node, error)
- func (e *Entry) Merge(other *Entry) error
- func (e *Entry) Name() string
- func (e *Entry) SetPath(parent []string, current string)
- func (e *Entry) String() string
- func (e *Entry) ToOP() []*op.ItemField
- func (e *Entry) TypeStr() string
- func (e *Entry) UnmarshalYAML(node *yaml.Node) error
- type OutputMode
Constants ¶
const YAMLTypeMetaConfig string = "!!joao"
const YAMLTypeSecret string = "!!secret"
Variables ¶
This section is empty.
Functions ¶
func AutocompleteKeys ¶
func KeysFromYAML ¶
func VaultAndNameFrom ¶
VaultAndNameFrom path/buffer reads a path (unless a buffer is provided) and gets the 1Password item name and vault name: first, it looks at the embedded `_config: !!joao` YAML item. if it still needs a vault or name, it looks for the repo config, erroring if none found otherwise, it'll fill in missing values from the found repo config
Types ¶
type Config ¶
func (*Config) AsJSON ¶
AsJSON returns the config enconded as JSON, optionally encoding as a 1Password item.
func (*Config) AsYAML ¶
func (cfg *Config) AsYAML(modes ...OutputMode) ([]byte, error)
AsYAML returns the config encoded as YAML.
func (*Config) DiffRemote ¶
func (*Config) MarshalYAML ¶
MarshalYAML implements `yaml.Marshal“.
func (*Config) Set ¶
Set a new value, optionally parsing the supplied bytes as a secret or a JSON-encoded value.
type Entry ¶
type Entry struct { Value string Kind yaml.Kind Tag string Path []string Content []*Entry Style yaml.Style FootComment string LineComment string HeadComment string Line int Column int // The ShortTag Type string }
Entry is a configuration entry. Basically a copy of a yaml.Node with extra methods.
func (*Entry) ChildNamed ¶
func (*Entry) MarshalYAML ¶
func (*Entry) UnmarshalYAML ¶
type OutputMode ¶
type OutputMode uint8
const ( // OutputModeRoundTrip outputs the input as-is. OutputModeRoundTrip OutputMode = iota // OutputModeRedacted prints empty secret values. OutputModeRedacted // OutputModeNoComments does not output comments. OutputModeNoComments OutputMode = 2 // OutputModeSorted outputs map keys in alphabetical order. OutputModeSorted OutputMode = 4 // OutputModeNoConfig does not output the _config key if any. OutputModeNoConfig OutputMode = 8 // OutputModeStandardYAML formats strings and arrays uniformly. OutputModeStandardYAML OutputMode = 16 )