Commit Graph

36 Commits

Author SHA1 Message Date
Elliot
d1cec1ad18 fix to make it work with modules 2019-10-31 08:21:19 +11:00
Mike Farah
84de9c078d Improved handling of numeric keys
When there is no match at a given path, numeric keys are assumed to be strings.
To create an array '+' must be used.

e.g: yq n thing[+].cat fred
will create an array under thing, whereas
yq n thing[0].cat fred
will create a map under thing, with a key '0'
2019-05-16 10:03:54 +10:00
Mike Farah
b2fe3e6738 fixing delete splat 2019-05-14 11:20:41 +10:00
Mike Farah
774badfef4 Can delete splat!
Fixes https://github.com/mikefarah/yq/issues/175
2019-05-13 09:48:05 +10:00
Mike Farah
c4e9516aa6 Prefix matching splat
Fixes https://github.com/mikefarah/yq/issues/218
2019-05-13 09:32:08 +10:00
Mike Farah
323089eb64 fixed tests for write array splat 2019-05-13 09:13:45 +10:00
Mike Farah
53289366a5 Write array splat 2019-05-01 08:55:44 +10:00
Mike Farah
cda9a82906 Refactoring write command to allow splat 2019-05-01 08:40:35 +10:00
Mike Farah
2dbde6b9fb Can process numeric keys
Fixes: https://github.com/mikefarah/yq/issues/215
2019-04-30 09:43:09 +10:00
Mike Farah
77c8f22a79 Bump golang version to 1.11 2019-01-21 09:37:22 +11:00
Mike Farah
7a6689eb40 Fixed latest linting issues 2018-08-06 16:24:06 +10:00
Mike Farah
ae0c042ae6 Use gopkg managed version of yaml to properly support go get 2018-06-18 11:12:52 +10:00
Mike Farah
8ca85b1c64 Simplified merge command 2018-06-15 16:40:52 +10:00
Matthew Huxtable
8072e66d46 Add delete command
The delete (short option "d") will delete the YAML subtree at the
provided path in the specified file (or STDIN), if it the node exists.

More complex support is currently omitted, for example:

  - specify nodes to delete using an external script
  - deleting common elements from all elements of an array
2018-05-07 15:52:29 +10:00
kenjones
87b33e8603 Task: Upgrade to Golang 1.9 2017-09-27 07:05:18 -04:00
kenjones
185d1faadb Bugfix: Append when array empty results in null value
Initialize new array as empty instead of having a single value.

Resolves: #41
2017-09-25 09:31:06 -04:00
kenjones
c5f80a105d Feature: Add append to array
Adds the ability to append a value to an array instead of having to
know the index of the values within the array.

Resolves: #17
2017-09-23 20:21:16 -04:00
kenjones
6980be3800 Feature: Adds merge command
Adds merge command for merging multiple yaml files together.

Resolves: #31
2017-09-23 14:45:59 +10:00
kenjones
53b2c64747 Task: Increase test coverage, includes refactor
Adds test cases to increase test coverage.
Refactors code to enable adding tests by reducing the number of
locations where `os.Exit()` is called from.
2017-09-22 23:01:46 -04:00
kenjones
86639acf70 Task: Simplify development
The base directory has all shell scripts in scripts/
and all example/test files in examples/.
A Makefile provides all the commands with helpful information.
If a developer simply types `make` then vendor is properly updated,
the code is formatted, linted, tested, built, acceptance test run,
and installed.

Linting errors resolved.
Ignored test case (`TestParsePath`) updated to work as expected.
2017-09-23 08:37:34 +10:00
Mike Farah
b2a0964de2 switched from godeps to govendor, now supports new 'vendor' folder 2017-05-03 09:19:55 +10:00
Mike Farah
909b62be54 Fixed ability to grow arrays 2017-04-18 08:53:27 +10:00
Mike Farah
a3190f1504 Refactor write to allow new entries 2017-04-12 20:25:13 +10:00
Mike Farah
44ee869e47 Maintain order 2017-02-27 09:09:29 +11:00
Mike Farah
0d75edfb67 Fixed updating array bug (Issue 3 in git) 2017-02-09 13:58:47 +11:00
Morgan Larosa
2a283b4ef7 Fix #1 2016-03-16 16:11:06 +11:00
mfarah
955ecc2547 Removed usage of log 2015-10-06 16:39:19 +11:00
mfarah
81672d4efe Can now splat maps 2015-10-06 10:08:31 +11:00
mfarah
805729e4f7 DRYd code 2015-10-06 09:25:55 +11:00
mfarah
7db31006da Fixed write bug: can now update yaml with single key in path 2015-10-05 16:03:11 +11:00
mfarah
8efc46deae Fixed bad paths causing recursing down scalar values 2015-10-05 14:47:24 +11:00
mfarah
e4d5769f29 Added array splat functionality 2015-10-05 14:41:50 +11:00
Mike Farah
690442d02e Handles keys that dont exit 2015-10-03 17:06:49 +10:00
Mike Farah
d1c545cca0 Handle index out of range when reading arrays 2015-10-03 17:04:12 +10:00
Mike Farah
c4af37ed68 Custom path parsing 2015-10-03 17:04:12 +10:00
Mike Farah
01845ea923 Split code 2015-10-02 09:05:13 +10:00