Skip to content

Commit bbaa77b

Browse files
authored
Add delimiter option to serialize command. (#32)
* Add delimiter option to serialize command. * Update delimiter split logic. * Update version to 0.6.0 Co-authored-by: Ryan A. Tran <[email protected]>
1 parent cd98c87 commit bbaa77b

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to Merlin Spellbook will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.6.0]
8+
9+
## Added
10+
- Delimiter option in serialization command.
11+
12+
## Changed
13+
- In serialize command, grab the first entry as the key and everything else as the value.
14+
715
## [0.5.3]
816

917
## Fixed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# LLNL-CODE-797170
88
# All rights reserved.
9-
# This file is part of Merlin-Spellbook, Version: 0.5.3.
9+
# This file is part of Merlin-Spellbook, Version: 0.6.0.
1010
#
1111
# For details, see https://github.com/LLNL/merlin-spellbook.
1212
#

spellbook/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "0.5.3"
1+
__version__ = "0.6.0"
22

33
VERSION = __version__

spellbook/commands/serialize.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828
type=str,
2929
help="key to indicate a nested value, default: /",
3030
)
31+
@click.option(
32+
"--delimiter",
33+
required=False,
34+
default="=",
35+
type=str,
36+
help="key to indicate delimiter value, default: =",
37+
)
3138
@click.option(
3239
"--verbose",
3340
is_flag=True,
@@ -44,7 +51,7 @@
4451
type=bool,
4552
help="indent with new lines, default False",
4653
)
47-
def cli(output, vars, splitter, verbose, indent):
54+
def cli(output, vars, splitter, delimiter, verbose, indent):
4855
"""
4956
write a serialized file from cli arguments.
5057
"""
@@ -55,6 +62,7 @@ def cli(output, vars, splitter, verbose, indent):
5562
"output": output,
5663
"vars": vars,
5764
"splitter": splitter,
65+
"delimiter": delimiter,
5866
"verbose": verbose,
5967
"indent": indent,
6068
}

spellbook/data_formatting/conduit/python/conduit_bundler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# LLNL-CODE-<PENDING>
88
# All rights reserved.
9-
# This file is part of merlin-spellbook, Version: 0.5.3.
9+
# This file is part of merlin-spellbook, Version: 0.6.0.
1010
#
1111
# For details, see https://github.com/LLNL/merlin-spellbook.
1212
#

spellbook/data_formatting/serialize.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ def convert_string(string):
2727
return string
2828

2929

30-
def nested_dict(var_list, splitter="/"):
30+
def nested_dict(var_list, splitter="/", delimiter="="):
3131
output = {}
3232
for v in var_list:
33-
keys, val = v.split("=")
33+
keys, val = v.split(delimiter, 1)
3434
keylist = keys.split(splitter)
3535
value = convert_string(val)
3636
nested_set(output, keylist, value)
3737
return output
3838

3939

4040
def parse_args(args):
41-
output = nested_dict(args.vars, splitter=args.splitter)
41+
output = nested_dict(args.vars, splitter=args.splitter, delimiter=args.delimiter)
4242
dumpargs = {"sort_keys": True}
4343
if args.indent:
4444
dumpargs["indent"] = 4

spellbook/log_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# LLNL-CODE-797170
88
# All rights reserved.
9-
# This file is part of Merlin Spellbook, Version: 0.5.3.
9+
# This file is part of Merlin Spellbook, Version: 0.6.0.
1010
#
1111
# For details, see https://github.com/LLNL/merlin.
1212
#

0 commit comments

Comments
 (0)