Add a more detailed usage note, and use logrus

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/aya/trunk@59 cec141ff-132a-4243-88a5-ce187bd62f94
This commit is contained in:
yakumo.izuru
2023-04-18 12:29:12 +00:00
parent c069a82124
commit 02ed102707
3 changed files with 32 additions and 3 deletions

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
@@ -16,6 +15,7 @@ import (
"github.com/russross/blackfriday/v2"
"gopkg.in/yaml.v2"
"marisa.chaotic.ninja/aya"
log "github.com/sirupsen/logrus"
)
const (
@@ -303,10 +303,22 @@ func init() {
os.Setenv("PATH", p)
}
func printUsage() {
fmt.Printf("%v <command> [args]\n", os.Args[0])
fmt.Printf("\n")
fmt.Printf("Where <command> is:\n")
fmt.Printf("\tbuild\tGenerate site\n")
fmt.Printf("\twatch\t(Re)generate site while looking for changes\n")
fmt.Printf("\tvar\tQuery a variable from a markdown file\n")
fmt.Printf("\tversion\tPrint version and exit\n")
fmt.Printf("\n")
fmt.Printf("Other commands may be dynamically added by plugins found in %v\n", AYADIR)
os.Exit(0)
}
func main() {
if len(os.Args) == 1 {
fmt.Println(os.Args[0], "<command> [args]")
return
printUsage()
}
cmd := os.Args[1]
args := os.Args[2:]