diff --git a/.gitignore b/.gitignore index 5cd1706..2f1cf5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin/ TODO dela.db +dela.zip \ No newline at end of file diff --git a/Makefile b/Makefile index e8faab9..be0bc57 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ all: cp -r scripts bin && \ cp -r static bin +portable: clean all + cd bin/ && zip -r dela.zip * && mv dela.zip .. clean: rm -rf bin diff --git a/README.md b/README.md index 15f0a92..40c9144 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,30 @@ # dela (pun интедед) - daily events list application, aka web TODO list +## About + +dela is a web TODO list application which can be hosted on your server and accessed via browser. Current capabilities include: + +- Password protected account system +- TODO creation +- TODO completion + +## Build + +``` +make +``` + +or manually compile with `go build` inside the `src` directory, move the binary and put it alongside `pages`, `scripts` and `static` (although the path to the contents can be specified via configuration file). + +``` +make portable +``` + +will create a `dela.zip` archive with all the content directories and the binary which are to be freely transported to other machines (of the same OS and architecture, obviously) + +## Use + +After the first run a configuration file will be put alongside the executable, upon the second launch server will start and the service will be accessible on the specified port. ## License diff --git a/src/main.go b/src/main.go index 9b7e1a5..0096ab8 100644 --- a/src/main.go +++ b/src/main.go @@ -22,10 +22,18 @@ import ( "Unbewohnte/dela/conf" "Unbewohnte/dela/logger" "Unbewohnte/dela/server" + "flag" + "fmt" "os" "path/filepath" ) +const Version string = "0.1.0" + +var ( + printVersion *bool = flag.Bool("version", false, "Print version information and exit") +) + const ConfName string = "conf.json" var ( @@ -34,6 +42,13 @@ var ( ) func init() { + // Parse flags + flag.Parse() + if *printVersion { + fmt.Printf("dela v%s - a web TODO list\n(c) 2023 Kasyanov Nikolay Alexeyevich (Unbewohnte)\n", Version) + os.Exit(0) + } + // Initialize logging logger.SetOutput(os.Stdout)