mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 04:46:41 -04:00
Implement temporary "init" functionality
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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})
|
||||
}
|
||||
Reference in New Issue
Block a user