Compare commits

..

No commits in common. "26b6a2d3498ca9e51b520fd953111aa0002398f2" and "78d3fe54b532084d4fbc9a117a893accea28cfc7" have entirely different histories.

2 changed files with 11 additions and 14 deletions

View file

@ -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.1" version string = "0.1.0"
help_template string = `NAME: help_template string = `NAME:
{{.Name}} {{if .Version}}v{{.Version}}{{end}} - {{.Usage}} {{.Name}} {{if .Version}}v{{.Version}}{{end}} - {{.Usage}}
@ -60,7 +60,6 @@ var (
identities = append(identities, id) identities = append(identities, id)
} }
gave_identities = true
return nil return nil
}, },
}, },
@ -88,7 +87,6 @@ var (
} }
recipients = append(recipients, r) recipients = append(recipients, r)
} }
gave_recipients = true
return nil return nil
}, },
}, },
@ -206,7 +204,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 len(identities) == 0 {
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 {
@ -223,7 +221,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 !gave_recipients && cfg.RecipientFile != "" { if len(recipients) == 0 {
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 {

View file

@ -20,7 +20,6 @@ var (
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() {