Skip to content

Append flag doesnt add newline if not present in file #852

Open
@Waterdrips

Description

Expected Behaviour

The append flag shuld a function correctly if the file doesn't have a newline at the end

Current Behaviour

When using faas-cli new --append stack.yml i have found that this doesnt append a newline if one is not present in the file

I therefore created a new function and it appended like this

  route53:
    lang: golang-middleware
    handler: ./route53
    image: route53:latest  route54:       # <-- appended to here without newline
    lang: golang-middleware
    handler: ./route54
    image: route54:latest

Possible Solution

check the stack file for a newline, if not present add one?

Steps to Reproduce (for bugs)

  1. faas-cli new --lang golang new -f stack.yml
  2. remove newlines from the stack.yml
  3. faas-cli new --lang golang new2 --append stack.yml
  4. check file, its not added a newline before the func so its squashed the the last line of the first definition

Context

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|

CLI:
 commit:  598336a0cad38a79d5466e6a3a9aebab4fc61ba9
 version: 0.12.21
Error with YAML file
  • Operating System and version (e.g. Linux, Windows, MacOS):
    Linux

Metadata

Type

No type

Projects

  • Status

    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions