mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-11 01:09:54 +00:00
Change "new line" to "newline"
This commit is contained in:
parent
c9a4540c5f
commit
3399f1fa01
@ -27,7 +27,7 @@ a: |
|
|||||||
cat
|
cat
|
||||||
```
|
```
|
||||||
|
|
||||||
Using `$( exp )` wont work, as it will trim the trailing new line.
|
Using `$( exp )` wont work, as it will trim the trailing newline.
|
||||||
|
|
||||||
```
|
```
|
||||||
m=$(echo "cat\n") yq -n '.a = strenv(m)'
|
m=$(echo "cat\n") yq -n '.a = strenv(m)'
|
||||||
@ -49,7 +49,7 @@ a: |
|
|||||||
cat
|
cat
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, if you're trying to set the content from a file, and want a trailing new line:
|
Similarly, if you're trying to set the content from a file, and want a trailing newline:
|
||||||
|
|
||||||
```
|
```
|
||||||
IFS= read -rd '' output < <(cat my_file)
|
IFS= read -rd '' output < <(cat my_file)
|
||||||
|
|||||||
@ -27,7 +27,7 @@ a: |
|
|||||||
cat
|
cat
|
||||||
```
|
```
|
||||||
|
|
||||||
Using `$( exp )` wont work, as it will trim the trailing new line.
|
Using `$( exp )` wont work, as it will trim the trailing newline.
|
||||||
|
|
||||||
```
|
```
|
||||||
m=$(echo "cat\n") yq -n '.a = strenv(m)'
|
m=$(echo "cat\n") yq -n '.a = strenv(m)'
|
||||||
@ -49,7 +49,7 @@ a: |
|
|||||||
cat
|
cat
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, if you're trying to set the content from a file, and want a trailing new line:
|
Similarly, if you're trying to set the content from a file, and want a trailing newline:
|
||||||
|
|
||||||
```
|
```
|
||||||
IFS= read -rd '' output < <(cat my_file)
|
IFS= read -rd '' output < <(cat my_file)
|
||||||
|
|||||||
@ -51,7 +51,7 @@ func (pe *propertiesEncoder) PrintLeadingContent(writer io.Writer, content strin
|
|||||||
|
|
||||||
if errors.Is(errReading, io.EOF) {
|
if errors.Is(errReading, io.EOF) {
|
||||||
if readline != "" {
|
if readline != "" {
|
||||||
// the last comment we read didn't have a new line, put one in
|
// the last comment we read didn't have a newline, put one in
|
||||||
if err := writeString(writer, "\n"); err != nil {
|
if err := writeString(writer, "\n"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ func (ye *yamlEncoder) PrintLeadingContent(writer io.Writer, content string) err
|
|||||||
|
|
||||||
if errors.Is(errReading, io.EOF) {
|
if errors.Is(errReading, io.EOF) {
|
||||||
if readline != "" {
|
if readline != "" {
|
||||||
// the last comment we read didn't have a new line, put one in
|
// the last comment we read didn't have a newline, put one in
|
||||||
if err := writeString(writer, "\n"); err != nil {
|
if err := writeString(writer, "\n"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,13 +79,13 @@ func encodeOperator(d *dataTreeNavigator, context Context, expressionNode *Expre
|
|||||||
|
|
||||||
original := originalList.Front().Value.(*CandidateNode)
|
original := originalList.Front().Value.(*CandidateNode)
|
||||||
originalNode := unwrapDoc(original.Node)
|
originalNode := unwrapDoc(original.Node)
|
||||||
// original block did not have a new line at the end, get rid of this one too
|
// original block did not have a newline at the end, get rid of this one too
|
||||||
if !endWithNewLine.MatchString(originalNode.Value) {
|
if !endWithNewLine.MatchString(originalNode.Value) {
|
||||||
stringValue = chomper.ReplaceAllString(stringValue, "")
|
stringValue = chomper.ReplaceAllString(stringValue, "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dont print a new line when printing json on a single line.
|
// dont print a newline when printing json on a single line.
|
||||||
if (preferences.format == JSONOutputFormat && preferences.indent == 0) ||
|
if (preferences.format == JSONOutputFormat && preferences.indent == 0) ||
|
||||||
preferences.format == CSVOutputFormat ||
|
preferences.format == CSVOutputFormat ||
|
||||||
preferences.format == TSVOutputFormat {
|
preferences.format == TSVOutputFormat {
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
4.30.6:
|
4.30.6:
|
||||||
- Fixed xml comment in array of scalars #1465
|
- Fixed xml comment in array of scalars #1465
|
||||||
- Include blank new lines in leading header preprocessing #1462
|
- Include blank newlines in leading header preprocessing #1462
|
||||||
- Added aarch64 build (#1261)
|
- Added aarch64 build (#1261)
|
||||||
- Bumped dependency versions (#1453)
|
- Bumped dependency versions (#1453)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user