Compare commits
3 commits
c4ee8e7b04
...
5e90d8f138
Author | SHA1 | Date | |
---|---|---|---|
Lilian Jónsdóttir | 5e90d8f138 | ||
Lilian Jónsdóttir | 13e91157da | ||
Lilian Jónsdóttir | b18ea5ff7b |
|
@ -22,7 +22,7 @@ import (
|
||||||
const (
|
const (
|
||||||
name string = "agedit"
|
name string = "agedit"
|
||||||
usage string = "Edit age encrypted files with your $EDITOR"
|
usage string = "Edit age encrypted files with your $EDITOR"
|
||||||
version string = "0.2.0"
|
version string = "0.2.1"
|
||||||
help_template string = `NAME:
|
help_template string = `NAME:
|
||||||
{{.Name}} {{if .Version}}v{{.Version}}{{end}} - {{.Usage}}
|
{{.Name}} {{if .Version}}v{{.Version}}{{end}} - {{.Usage}}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ func action(ctx *cli.Context) error {
|
||||||
// read from identity file if exists and no identities have been supplied
|
// read from identity file if exists and no identities have been supplied
|
||||||
if !gave_identities {
|
if !gave_identities {
|
||||||
if _, err := os.Stat(cfg.IdentityFile); os.IsNotExist(err) {
|
if _, err := os.Stat(cfg.IdentityFile); os.IsNotExist(err) {
|
||||||
return fmt.Errorf("identity file unset and no identities supplied, use -i to specify an idenitity file or set one in the config file, or use -I to specify an age private key")
|
return fmt.Errorf("identity file unset and no identities supplied")
|
||||||
} else {
|
} else {
|
||||||
f, err := os.Open(cfg.IdentityFile)
|
f, err := os.Open(cfg.IdentityFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package editor
|
package editor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -18,6 +19,10 @@ type Editor struct {
|
||||||
func (e *Editor) EditFile(filename string) error {
|
func (e *Editor) EditFile(filename string) error {
|
||||||
args := append(e.Args, filename)
|
args := append(e.Args, filename)
|
||||||
|
|
||||||
|
if e.Command == "" {
|
||||||
|
return fmt.Errorf("no editor set or detected")
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command(e.Command, args...)
|
cmd := exec.Command(e.Command, args...)
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
|
|
Loading…
Reference in a new issue