Skip to content

Commit

Permalink
Release 0.35.0: add 'yaml2json' utility
Browse files Browse the repository at this point in the history
  • Loading branch information
Stig Bakken committed Sep 27, 2018
1 parent 4e231ee commit ccabd53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kubecd/__init__.py
@@ -1 +1 @@
__version__ = '0.34.0'
__version__ = '0.35.0'
4 changes: 4 additions & 0 deletions kubecd/cli/__init__.py
Expand Up @@ -14,6 +14,7 @@
indent_file,
init_contexts,
json2yaml,
yaml2json,
lint_environment,
list_kind,
observe_new_image,
Expand Down Expand Up @@ -115,6 +116,9 @@ def parser(prog='kcd') -> argparse.ArgumentParser:
j2y = s.add_parser('json2yaml', help='JSON to YAML conversion utility (stdin/stdout)')
j2y.set_defaults(func=json2yaml)

y2j = s.add_parser('yaml2json', help='YAML to JSON conversion utility (stdin/stdout)')
y2j.set_defaults(func=yaml2json)

init = s.add_parser('init', help='Initialize credentials and contexts')
init.add_argument('--cluster',
help='Initialize contexts for all environments in a cluster')
Expand Down
7 changes: 7 additions & 0 deletions kubecd/cli/commands.py
Expand Up @@ -105,6 +105,13 @@ def json2yaml(**kwargs):
yaml.safe_dump(obj, sys.stdout)


def yaml2json(**kwargs):
import json
from ruamel import yaml
obj = yaml.safe_load(sys.stdin)
json.dump(obj, sys.stdout)


def diff_release(environments_file: str, releases: List[str], env: str, **kwargs):
kcd_config = _load_model(environments_file)
e = kcd_config.get_environment(env)
Expand Down

0 comments on commit ccabd53

Please sign in to comment.