mirror of
https://github.com/dnote/dnote
synced 2026-03-16 15:35:52 +01:00
Simplify view and edit command (#184)
* Simplify the view command * Simplify the edit command * Migrate number-only book names * Run migration * Simplify remove * Print note info when adding, editing, or removing * Disallow users from editing or removing already removed notes
This commit is contained in:
parent
cc27714fb6
commit
f526124243
16 changed files with 447 additions and 113 deletions
|
|
@ -26,6 +26,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
|
|
@ -248,3 +249,15 @@ func CopyFile(src, dest string) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// regexNumber is a regex that matches a string that looks like an integer
|
||||
var regexNumber = regexp.MustCompile(`^\d+$`)
|
||||
|
||||
// IsNumber checks if the given string is in the form of a number
|
||||
func IsNumber(s string) bool {
|
||||
if s == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return regexNumber.MatchString(s)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue