add --create and --ifexists options to line #342

Open
stephan wants to merge 2 commits from stephan/cdist:line_create_ifexists into master
Contributor

Add the options create to create the file if it does not exist and ifexists to skip the modification if the file does not exist.

Add the options create to create the file if it does not exist and ifexists to skip the modification if the file does not exist.
stephan added 1 commit 2022-07-29 20:48:32 +00:00
Owner

Hey @stephan ! How is --create different from the exact same version of the file type? I.e. what do we gain by adding this?

Hey @stephan ! How is --create different from the exact same version of the file type? I.e. what do we gain by adding this?
Owner

In regards to ifexists, I understand that there might be a use case (would be great if you can add this one to the documenntation part), but I find the naming a bit tricky:

  • ifexists might imply that "only do things if the file exists", which is the default
  • ifexists might refer to an existing line

I was first inclined to name it "only-if-file-exists", but that actually does not describe the situation. The introduced behaviour is:

  • Ignore the line if the file does not exist

So the most reasonable parameter that comes to my mind would be: ignore-if-file-does-not-exist, which we might want to shrink down a little bit.

Open for suggestions, but I don't think ifexists is the final one.

In regards to `ifexists`, I understand that there might be a use case (would be great if you can add this one to the documenntation part), but I find the naming a bit tricky: * ifexists might imply that "only do things if the file exists", which is the default * ifexists might refer to an existing line I was first inclined to name it "only-if-file-exists", but that actually does not describe the situation. The introduced behaviour is: * Ignore the line if the file does not exist So the most reasonable parameter that comes to my mind would be: `ignore-if-file-does-not-exist`, which we might want to shrink down a little bit. Open for suggestions, but I don't think `ifexists` is the final one.
stephan added 1 commit 2022-07-31 17:30:49 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u line_create_ifexists:stephan-line_create_ifexists
git checkout stephan-line_create_ifexists

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout master
git merge --no-ff stephan-line_create_ifexists
git checkout stephan-line_create_ifexists
git rebase master
git checkout master
git merge --ff-only stephan-line_create_ifexists
git checkout stephan-line_create_ifexists
git rebase master
git checkout master
git merge --no-ff stephan-line_create_ifexists
git checkout master
git merge --squash stephan-line_create_ifexists
git checkout master
git merge --ff-only stephan-line_create_ifexists
git checkout master
git merge stephan-line_create_ifexists
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#342
No description provided.