The Emperor (IV)
* `aya help` is provided by aya.PrintUsage() now Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/aya/trunk@76 cec141ff-132a-4243-88a5-ce187bd62f94
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6.6 2023-12-03 23:48:17+0000, yakumo_izuru Exp $
|
// $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6.7 2023-12-04 01:55:36+0000, yakumo_izuru Exp $
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -375,23 +375,11 @@ func init() {
|
|||||||
os.Setenv("PATH", p)
|
os.Setenv("PATH", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print usage notes
|
|
||||||
func printUsage() {
|
|
||||||
fmt.Printf("Usage: %s <command> [args]\n", os.Args[0])
|
|
||||||
fmt.Printf("Where <command> is one of\n")
|
|
||||||
fmt.Printf("\n")
|
|
||||||
fmt.Printf("\tbuild\t(Re-)builds site or a specific file\n")
|
|
||||||
fmt.Printf("\tclean\trm -rf %s\n", PUBDIR)
|
|
||||||
fmt.Printf("\tserve\tServes the %s directory over HTTP\n", PUBDIR)
|
|
||||||
fmt.Printf("\tvar\tPrint a list of variables defined in a given file, or values of certain variables\n")
|
|
||||||
fmt.Printf("\twatch\t(Re-)builds site and looks for changes\n")
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) == 1 {
|
if len(os.Args) == 1 {
|
||||||
printUsage()
|
fmt.Println("No command supplied. See 'aya help'")
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
cmd := os.Args[1]
|
cmd := os.Args[1]
|
||||||
args := os.Args[2:]
|
args := os.Args[2:]
|
||||||
@@ -412,7 +400,7 @@ func main() {
|
|||||||
fmt.Println("Removing generated site directory")
|
fmt.Println("Removing generated site directory")
|
||||||
os.RemoveAll(PUBDIR)
|
os.RemoveAll(PUBDIR)
|
||||||
case "help":
|
case "help":
|
||||||
printUsage()
|
aya.PrintUsage()
|
||||||
case "serve":
|
case "serve":
|
||||||
aya.HttpServe(PUBDIR)
|
aya.HttpServe(PUBDIR)
|
||||||
case "var":
|
case "var":
|
||||||
|
|||||||
17
usage.go
Normal file
17
usage.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package aya
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PrintUsage() {
|
||||||
|
fmt.Printf("aya/%v\n", FullVersion())
|
||||||
|
fmt.Println("Homepage: https://aya.chaotic.ninja")
|
||||||
|
fmt.Println("Repository: https://git.chaotic.ninja/yakumo.izuru/aya")
|
||||||
|
fmt.Println("==")
|
||||||
|
fmt.Println("build [file] · (Re)build a site or a file in particular")
|
||||||
|
fmt.Println("clean · Remove the generated .pub directory")
|
||||||
|
fmt.Println("==")
|
||||||
|
fmt.Println("For more information please read the manual page")
|
||||||
|
fmt.Println("man aya")
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// Set to current tag
|
// Set to current tag
|
||||||
Version = "v0.6.6"
|
Version = "v0.6.7"
|
||||||
Time = time.Now()
|
Time = time.Now()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user