Compare commits
No commits in common. "5a96e7969444ee0f812e85e408914fb8102e8915" and "6aa7aca85e3be116dc75e941f616399d9bc2dc1c" have entirely different histories.
5a96e79694
...
6aa7aca85e
|
@ -1,6 +1,6 @@
|
|||
# agedit
|
||||
|
||||
open an [age](https://github.com/FiloSottile/age) encrypted file in $EDITOR
|
||||
open an age encrypted file in $EDITOR
|
||||
|
||||
## cli
|
||||
`go install git.burning.moe/celediel/agedit/cmd/agedit@latest`
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
const (
|
||||
name = "agedit"
|
||||
usage = "Edit age encrypted files with your $EDITOR"
|
||||
version = "0.0.2"
|
||||
version = "0.0.1"
|
||||
help_template = `NAME:
|
||||
{{.Name}} {{if .Version}}v{{.Version}}{{end}} - {{.Usage}}
|
||||
|
||||
|
@ -115,7 +115,7 @@ func before(ctx *cli.Context) error {
|
|||
|
||||
// load config from file
|
||||
_, err := os.Open(configFile)
|
||||
if err != nil && errors.Is(err, os.ErrNotExist) {
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
// or not
|
||||
logger.Debug("couldn't load config file", "file", configFile)
|
||||
} else {
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module git.burning.moe/celediel/agedit
|
||||
|
||||
go 1.21.0
|
||||
go 1.22.0
|
||||
|
||||
require (
|
||||
filippo.io/age v1.1.1
|
||||
|
|
|
@ -75,7 +75,7 @@ func TestEncryptionDecryption(t *testing.T) {
|
|||
|
||||
// TestNewIdentity creats a new identity, writes it to file, then re-reads it back from the file.
|
||||
func TestNewIdentity(t *testing.T) {
|
||||
for i := 0; i <= 1000; i++ {
|
||||
for range 1000 {
|
||||
outfile := generator.GenerateFullPath()
|
||||
|
||||
identity, err := NewIdentity()
|
||||
|
|
12
pkg/env/env.go
vendored
12
pkg/env/env.go
vendored
|
@ -78,24 +78,16 @@ func GetDataDir(appname string) string {
|
|||
//
|
||||
// returns %TEMP% on Windows, /tmp on UNIX-like systems
|
||||
func GetTempDirectory() string {
|
||||
var tmp string
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
tmp = os.Getenv("TEMP")
|
||||
case "android":
|
||||
if t := os.Getenv("TMPDIR"); t != "" {
|
||||
tmp = t
|
||||
} else if t = os.Getenv("PREFIX"); t != "" {
|
||||
tmp = t + "/tmp"
|
||||
}
|
||||
return os.Getenv("TEMP")
|
||||
default:
|
||||
fallthrough
|
||||
case "darwin":
|
||||
fallthrough
|
||||
case "linux":
|
||||
tmp = "/tmp"
|
||||
return "/tmp"
|
||||
}
|
||||
return tmp
|
||||
}
|
||||
|
||||
func make_path(paths ...string) string {
|
||||
|
|
|
@ -12,7 +12,7 @@ var generator = NewGenerator("test_", ".txt", 18)
|
|||
func TestCanCreateTmpFile(t *testing.T) {
|
||||
b := []byte{104, 101, 108, 108, 111, 32, 116, 104, 101, 114, 101}
|
||||
|
||||
for i := 0; i <= 1000; i++ {
|
||||
for range 1000 {
|
||||
outfile := generator.GenerateFullPath()
|
||||
err := os.WriteFile(outfile, b, fs.FileMode(0600))
|
||||
if err != nil {
|
||||
|
@ -33,7 +33,7 @@ func TestCanCreateTmpFile(t *testing.T) {
|
|||
func TestUniqueTmpFile(t *testing.T) {
|
||||
var generated_names = map[string]string{}
|
||||
|
||||
for i := 0; i <= 100000; i++ {
|
||||
for range 100000 {
|
||||
name := generator.GenerateName()
|
||||
if val, ok := generated_names[name]; ok {
|
||||
t.Fatal("Non unique name", val)
|
||||
|
|
Loading…
Reference in a new issue