Remove first line `---`
See original GitHub issueProposal: Remove ---
from the top of each YAML file, if it does not start with a front matter block
Author: Your Name <@lucendio>
Date: 2019-09-01
- Status: New
- Proposal type: file syntax
- Estimated time to implement: 2 days
Motivation
One way to use Molecule is to start by generating a skeleton. This results in a lot of files starting with a line that is not needed in most cases.
Problems
This first line (---
) is unnecessary in most cases and can lead to confusion by the reader as well as to inconsistency in the project where Molecule generates code into.
Solution proposal
Remove the first line consisting of ---
from each YAML file that does not start with a front matter or contains multiple YAML documents.
Dependencies
Possibly the (version of the) YAML parser being used by Ansible.
Testing
Use existing test facilities to see if something breaks.
Documentation
Probably referring to Ansible Docs: YAML Syntax, which states that this line is optional.
Anything else?
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How can I remove the first line of a text file using bash/sed ...
If you want to remove the first line inside the file, you should use: ... The following command will delete the first line...
Read more >Remove the First Line of a Text File in Linux - Baeldung
Removing the first line from an input file using the sed command is pretty straightforward. Let's see how to solve the problem with...
Read more >remove first line in bash - Super User
Do you have a method to quickly remove the first line of a file in bash shell ? I mean using sed or...
Read more >Commands on how to delete a first line from a text file using ...
In this short config we will show a multiple options on how to remove a first line from a text file. Here is...
Read more >Delete First line of a file - shell script - Unix Stack Exchange
The first thing that happens with that line is the redirection. The file "file.txt" is opened and truncated to 0 bytes. After that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Odd. I have always made sure that
---
is in all my yaml documents. I like the consistency across all files. If I don’t see the---
then I have to double check the line number to see if I’m at the top of the file or check my history to make sure I didn’t inadvertently delete it. It’s interesting to see when opinions differ 😄Is not molecule goal to make decisions about this. Ansible-lint and yamllint are projects more suited to make decision in this area.
I personally am in favour of not using
---
when is not needed, but I am in a position to impose my preference.