cfctl

command
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 1 Imported by: 0

README

cfctl

NOTICE: The problem that viper does not partition case may cause is that the value of the key that has never been set will become lowercase.

command

Support config type which is supported by viper.

  • dotenv
  • hcl
  • ini
  • javaproperties
  • json
  • toml
  • yaml

Use cfctl -h to get all usage.

get
cfctl get key -f test.toml
cfctl get key.0 -f test.toml
cfctl get a.b.c -f test.toml

# specify output, may unmarshal error
cfctl get "*" -f test.toml -o yaml
cfctl get x.y -f test.toml -o json
set
cfctl set_string key value -f test.toml
cfctl set_int key 1 -f test.toml
cfctl set_ins key 1,2,3 -f test.toml
cfctl set_object key '{"key":"value"}' -f test.toml
cfctl set_objects key '{"key":"value"},{"key":"value"}' -f test.toml

# if index not exist in key, will occurs error.
# You can use append command to do it. But if it is a empty array, you can not append.
# In this condition, you can use set_ints and so on to initialize an array.
cfctl set_int key.0 4 -f test.toml
append
cfctl append key '{"name":"value2"}' -f _example/test.json

# if array in array
cfctl append key.0.name '{"xx":"value2"}' -f _example/test.json
del
cfctl del nj -f _example/test.toml
cfctl del nj.jaronnie.name -f _example/test.toml
cfctl del array.0 -f _example/test.json

todo

  • set_string
  • set_int
  • set_float
  • set_object
  • set_bool
  • set_strings
  • set_ints
  • set_floats
  • set_objects
  • get
  • append
  • del

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL