-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Description
I want to read a command output and write a new file.
What is good way to do it?
from invoke import task,Context,Result
@task
def replace(c):
c:Context
r:Result = c.run("cat file")
t = r.stdout.replace("hoge","fuga")
c.run(f'echo "{t}" > new_file')from invoke import task,Context,Result
@task
def replace(c):
c:Context
r:Result = c.run("cat file")
t = r.stdout.replace("hoge","fuga")
with open("new_file", "w" ) as f:
f.write(t)If I use fabric2, I can use fabric.transfer.Transfer.put(). But must write a temporary file at local.
I think it's not good way.
Metadata
Metadata
Assignees
Labels
No labels