diff --git a/src/cli/entryList.go b/src/cli/entryList.go index 14ee68a..20e9431 100644 --- a/src/cli/entryList.go +++ b/src/cli/entryList.go @@ -88,16 +88,12 @@ func EntryListGen() { // check for errors encountered while walking directory if err != nil { - // create EntryRoot if the error is the result of it not existing on the system if os.IsNotExist(err) { - _ = os.Mkdir(offline.EntryRoot, 0700) - dirList = append(dirList, "") + fmt.Println(offline.AnsiError + "The entry directory does not exist - run \"mutn init\" to create it" + offline.AnsiReset) } else { // otherwise, print the source of the error fmt.Println(offline.AnsiError + "An unexpected error occurred while generating the entry list: " + err.Error() + offline.AnsiReset) } - // quit walking EntryRoot and return nil to allow the program to continue - return nil } // trim root path from each path before storing diff --git a/src/cli/init.go b/src/cli/init.go new file mode 100644 index 0000000..93fa6c2 --- /dev/null +++ b/src/cli/init.go @@ -0,0 +1,20 @@ +package cli + +import ( + "github.com/rwinkhart/MUTN/src/offline" + "os" + "os/exec" +) + +func TempInitCli() { + // gpgID + cmd := exec.Command("gpg", "-k") + cmd.Stdout = os.Stdout + cmd.Run() + gpgID := input("GPG key ID:") + + // textEditor + textEditor := input("Text editor (leave blank for $EDITOR, falls back to \"vi\"):") + + offline.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID}) +}