Compare commits
2 commits
78d3fe54b5
...
26b6a2d349
Author | SHA1 | Date | |
---|---|---|---|
Lilian Jónsdóttir | 26b6a2d349 | ||
Lilian Jónsdóttir | 6550468048 |
|
@ -21,7 +21,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.1.0"
|
version string = "0.1.1"
|
||||||
help_template string = `NAME:
|
help_template string = `NAME:
|
||||||
{{.Name}} {{if .Version}}v{{.Version}}{{end}} - {{.Usage}}
|
{{.Name}} {{if .Version}}v{{.Version}}{{end}} - {{.Usage}}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ var (
|
||||||
|
|
||||||
identities = append(identities, id)
|
identities = append(identities, id)
|
||||||
}
|
}
|
||||||
|
gave_identities = true
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -87,6 +88,7 @@ var (
|
||||||
}
|
}
|
||||||
recipients = append(recipients, r)
|
recipients = append(recipients, r)
|
||||||
}
|
}
|
||||||
|
gave_recipients = true
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -204,7 +206,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 len(identities) == 0 {
|
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, use -i to specify an idenitity file or set one in the config file, or use -I to specify an age private key")
|
||||||
} else {
|
} else {
|
||||||
|
@ -221,7 +223,7 @@ func action(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// read from recipient file if it exists and no recipients have been supplied
|
// read from recipient file if it exists and no recipients have been supplied
|
||||||
if len(recipients) == 0 {
|
if !gave_recipients && cfg.RecipientFile != "" {
|
||||||
if _, err := os.Stat(cfg.RecipientFile); os.IsNotExist(err) {
|
if _, err := os.Stat(cfg.RecipientFile); os.IsNotExist(err) {
|
||||||
return fmt.Errorf("recipient file doesn't exist")
|
return fmt.Errorf("recipient file doesn't exist")
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,14 +12,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
identities []age.Identity
|
identities []age.Identity
|
||||||
recipients []age.Recipient
|
recipients []age.Recipient
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
cfg config.Config
|
cfg config.Config
|
||||||
edt editor.Editor
|
edt editor.Editor
|
||||||
configFile string
|
configFile string
|
||||||
input_file, output_file string
|
input_file, output_file string
|
||||||
force_overwrite bool
|
force_overwrite bool
|
||||||
|
gave_identities, gave_recipients bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
Loading…
Reference in a new issue