summaryrefslogtreecommitdiffstats
path: root/pkg/commands/os.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r--pkg/commands/os.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go
index b72585e44..9756d619d 100644
--- a/pkg/commands/os.go
+++ b/pkg/commands/os.go
@@ -174,3 +174,14 @@ func (c *OSCommand) Unquote(message string) string {
message = strings.Replace(message, `"`, "", -1)
return message
}
+
+func (C *OSCommand) AppendLineToFile(filename, line string) error {
+ f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ _, err = f.WriteString("\n" + line)
+ return err
+}