Commit Graph

32 Commits

Author SHA1 Message Date
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
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
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
ae0c042ae6 Use gopkg managed version of yaml to properly support go get 2018-06-18 11:12: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
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
08ba0083be formatting 2017-04-18 09:14:06 +10:00
Mike Farah
909b62be54 Fixed ability to grow arrays 2017-04-18 08:53:27 +10:00
Mike Farah
373e0a5eb7 More tests 2017-04-14 12:39:55 +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
Mike Farah
5f09aabf4c Extracted out common test code 2015-10-10 19:18:54 +11:00
Mike Farah
98751cf607 Using godeps 2015-10-10 12:57:11 +11:00
mfarah
219105f999 Test result order no longer matters 2015-10-07 13:36:39 +11:00
mfarah
81672d4efe Can now splat maps 2015-10-06 10:08:31 +11:00
mfarah
6a696c81db Individual tests now have their own test data 2015-10-06 10:02:40 +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
8aa69fc9ba Handles quoted values when writing 2015-10-03 17:25:13 +10: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