Skip to content

clear update of -i #2407

Open
Open
@lavanyajagan

Description

@lavanyajagan

Please describe your feature request.
yq -i command is used for updating files for even multiple entries. Is it possible to add a feature to clear all the updates in the file and get back the original one
Eg. I wish I could use yq to clear all the updates done using --inplace command

Describe the solution you'd like
If we have data1.yml like:
(please keep to around 10 lines )

float: True
trace: False
runs: 1

And we run a command:

yq -i '.float=False | .runs=10' .data1.yml

it could output

float: False
trace: False
runs: 10

With the new feature if we can run the command:
yq -c data1.yml

float: True
trace: False
runs: 1

with maybe keeping track of all changes

Describe alternatives you've considered
yq -i '.float=True| .runs=1' .data1.yml

Additional context
if the data1.yml is maintained in git, it's better to reset to original values before committing.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions