diff --git a/cmd/add.go b/cmd/add.go index fcd2ec7..710b74d 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -16,7 +16,7 @@ limitations under the License. package cmd import ( - "github.com/jemmyh/terminal_note/note" + "github.com/jemmyh/tnote/note" "github.com/spf13/cobra" ) diff --git a/cmd/create.go b/cmd/create.go index 06d0e43..147baf9 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -18,7 +18,7 @@ package cmd import ( "fmt" - "github.com/jemmyh/terminal_note/note" + "github.com/jemmyh/tnote/note" "github.com/spf13/cobra" ) diff --git a/cmd/delete.go b/cmd/delete.go index 04eec0b..d5e71af 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -16,7 +16,7 @@ limitations under the License. package cmd import ( - "github.com/jemmyh/terminal_note/note" + "github.com/jemmyh/tnote/note" "github.com/spf13/cobra" ) diff --git a/cmd/print.go b/cmd/print.go index 0f3ccde..56d2b51 100644 --- a/cmd/print.go +++ b/cmd/print.go @@ -20,7 +20,7 @@ import ( "fmt" "github.com/boltdb/bolt" - "github.com/jemmyh/terminal_note/note" + "github.com/jemmyh/tnote/note" "github.com/spf13/cobra" ) diff --git a/cmd/root.go b/cmd/root.go index f4ef7a3..045474d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,7 +6,7 @@ import ( "os" "os/user" - "github.com/jemmyh/terminal_note/note" + "github.com/jemmyh/tnote/note" "github.com/spf13/cobra" "gopkg.in/AlecAivazis/survey.v1" ) diff --git a/cmd/version.go b/cmd/version.go index 967dda9..25390e2 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -18,7 +18,7 @@ package cmd import ( "fmt" - "github.com/jemmyh/terminal_note/note" + "github.com/jemmyh/tnote/note" "github.com/spf13/cobra" ) diff --git a/main.go b/main.go index d33d423..fa364c9 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ package main -import "github.com/jemmyh/terminal_note/cmd" +import "github.com/jemmyh/tnote/cmd" /* * @CreateTime: 2021/1/14 15:31 diff --git a/note/note.go b/note/note.go index 09c138a..f6b929f 100644 --- a/note/note.go +++ b/note/note.go @@ -15,17 +15,16 @@ import ( /* * @CreateTime: 2021/1/12 18:28 * @Author: Jemmy@hujm20150121@gmail.com -* @Description: note is a message in notebook +* @Description: note is a message in notebook, which is managed like a node in a double linked list. */ -// Note means a diary note +// Note means a note in notebook type Note struct { - ID []byte // 某一天20191214 - PrevID []byte // 上一条ID - NextID []byte // 下一条ID - Content []byte // 日记内容 - IsSecret bool // TODO: 是否加密,如果加密,则需要密码访问 - Timestamp int64 // 时间戳 + ID []byte + PrevID []byte + NextID []byte + Content []byte + Timestamp int64 } // NewNote returns a `Note` object with `content` and `timestamp` diff --git a/note/note_book.go b/note/note_book.go index 9a596f1..1d6d8db 100644 --- a/note/note_book.go +++ b/note/note_book.go @@ -198,7 +198,7 @@ func (b *NoteBook) DeleteNotePrefix(id []byte, userName, pwd string) { // GetDbFilePath returns the notebook path for userName. func GetDbFilePath(userName string) string { - // ~/.terminal_note/terminal_diary_xxx.db + // ~/.tnote/terminal_diary_xxx.db folderName := GetAppFolderPath() if _, err := os.Stat(folderName); os.IsNotExist(err) { err := os.Mkdir(folderName, os.ModePerm) @@ -248,7 +248,7 @@ func CheckDbFileExist(userName string) bool { } func GetAppFolderPath() string { - // ~/.terminal_note/ + // ~/.tnote/ user, _ := user2.Current() return user.HomeDir + "/" + GetAppHome() } diff --git a/note/varables.go b/note/varables.go index 597c78b..01038fc 100644 --- a/note/varables.go +++ b/note/varables.go @@ -12,13 +12,13 @@ const ( // version ... version = "v2.0.0" // appHome is the folder name for App - appHome = ".terminal_note" + appHome = ".tnote" // idLayout use timestamp as note id idLayout = "20060102150405" // dbFileNameTemplate local file to save a notebook - dbFileNameTemplate = ".terminal_note_%s.db" + dbFileNameTemplate = ".tnote_%s.db" // dbBucket bucket name to save all notes in a notebook dbBucket = "diary" // dbHeadKey default key to save the first tip note, which is generated default @@ -30,8 +30,8 @@ const ( tailContent = "end" rsaBits = 2048 - pubKeyTempName = "terminal_note_%s_rsa.pub" - prvTempName = "terminal_note_%s_rsa" + pubKeyTempName = "tnote_%s_rsa.pub" + prvTempName = "tnote_%s_rsa" ) // GetAppName ...