From 104ee66f5930f4a37ac84538c29a291bf1d08f4f Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Tue, 24 Jan 2023 20:27:22 +0800 Subject: Use cobra as command selector --- command.go | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 command.go (limited to 'command.go') diff --git a/command.go b/command.go deleted file mode 100644 index 803970b..0000000 --- a/command.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -import ( - "os" - "path/filepath" -) - -func Rename(source, target string) { - source, err := filepath.Abs(source) - if err != nil { - panic("Unable to get abspath of " + source) - } - - target, err = filepath.Abs(target) - if err != nil { - panic("Unable to get abspath of " + target) - } - - if !DocCollection.Contain(source) { - panic("Database doesn't contain " + source) - } - - if err := os.Rename(source, target); err != nil { - panic(err) - } - - doc := DocCollection[source] - for backlink := range doc.backlinks { - DocCollection[backlink].UpdateLinks(source, target) - } - -} -- cgit v1.2.3