ci: add Gitea CI workflows and release pipeline
Test / vet (push) Successful in 44s
Release / build (amd64, linux) (push) Successful in 39s
Release / build (arm64, linux) (push) Successful in 38s
Release / build (loong64, linux) (push) Successful in 39s
Release / build (riscv64, linux) (push) Successful in 39s
Test / test (push) Successful in 1m58s
Release / release (push) Successful in 18s
Test / build (push) Successful in 37s
Test / vet (push) Successful in 44s
Release / build (amd64, linux) (push) Successful in 39s
Release / build (arm64, linux) (push) Successful in 38s
Release / build (loong64, linux) (push) Successful in 39s
Release / build (riscv64, linux) (push) Successful in 39s
Test / test (push) Successful in 1m58s
Release / release (push) Successful in 18s
Test / build (push) Successful in 37s
Assisted-by: DeepSeek V4 Pro
This commit is contained in:
+64
-27
@@ -33,7 +33,7 @@ import (
|
||||
|
||||
// version is the release version, stamped at build time via
|
||||
// -ldflags "-X main.version=…" (defaulting to the current release).
|
||||
var version = "0.27.0"
|
||||
var version = "0.28.0"
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
@@ -73,39 +73,76 @@ func cmdVersion() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// ANSI color helpers for terminal output.
|
||||
const (
|
||||
colorReset = "\033[0m"
|
||||
colorBold = "\033[1m"
|
||||
colorCyan = "\033[36m"
|
||||
colorYellow = "\033[33m"
|
||||
colorGray = "\033[90m"
|
||||
)
|
||||
|
||||
// isTTY reports whether the writer is a terminal (for color output).
|
||||
func isTTY(w io.Writer) bool {
|
||||
if f, ok := w.(*os.File); ok {
|
||||
stat, _ := f.Stat()
|
||||
return (stat.Mode() & os.ModeCharDevice) != 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func usage(w io.Writer) {
|
||||
fmt.Fprintf(w, `gasm %s — developer tooling for Go's Plan 9 assembler (GAsm)
|
||||
useColor := isTTY(w)
|
||||
bold, cyan, yellow, gray, reset := "", "", "", "", ""
|
||||
if useColor {
|
||||
bold, cyan, yellow, gray, reset = colorBold, colorCyan, colorYellow, colorGray, colorReset
|
||||
}
|
||||
|
||||
gasm bundles a lexer, parser, formatter, linter, standalone assembler and
|
||||
language server for Plan 9 assembly into one self-contained binary.
|
||||
fmt.Fprintf(w, "%sgasm %s%s — developer tooling for Go's Plan 9 assembler (GAsm)%s\n\n", bold, version, reset, reset)
|
||||
fmt.Fprintf(w, "gasm bundles a lexer, parser, formatter, linter, standalone assembler and\n")
|
||||
fmt.Fprintf(w, "language server for Plan 9 assembly into one self-contained binary.\n\n")
|
||||
|
||||
Usage:
|
||||
gasm <command> [arguments]
|
||||
gasm [flags]
|
||||
fmt.Fprintf(w, "%sUsage:%s\n", yellow, reset)
|
||||
fmt.Fprintf(w, " gasm <command> [arguments]\n")
|
||||
fmt.Fprintf(w, " gasm [flags]\n\n")
|
||||
|
||||
Commands:
|
||||
tokens print the lexical token stream
|
||||
parse parse and report syntax errors
|
||||
fmt canonicalise formatting (gofmt for assembly)
|
||||
lint run static checks
|
||||
asm assemble .s files to machine code (amd64, riscv64)
|
||||
verify JIT-assemble and run dynamic checks (amd64, riscv64)
|
||||
lsp run the language server over stdio
|
||||
version print the version (same as --version)
|
||||
fmt.Fprintf(w, "%sCommands:%s\n", yellow, reset)
|
||||
commands := []struct{ name, desc string }{
|
||||
{"tokens", "print the lexical token stream"},
|
||||
{"parse", "parse and report syntax errors"},
|
||||
{"fmt", "canonicalise formatting (gofmt for assembly)"},
|
||||
{"lint", "run static checks"},
|
||||
{"asm", "assemble .s files to machine code (amd64, riscv64)"},
|
||||
{"verify", "JIT-assemble and run dynamic checks (amd64, riscv64)"},
|
||||
{"debug", "interactive source-level debugger (amd64)"},
|
||||
{"lsp", "run the language server over stdio"},
|
||||
{"version", "print the version (same as --version)"},
|
||||
}
|
||||
for _, c := range commands {
|
||||
fmt.Fprintf(w, " %s%-10s%s %s%s%s\n", cyan, c.name, reset, gray, c.desc, reset)
|
||||
}
|
||||
|
||||
Flags:
|
||||
-h, --help show this help
|
||||
-V, --version print the version
|
||||
fmt.Fprintf(w, "\n%sFlags:%s\n", yellow, reset)
|
||||
fmt.Fprintf(w, " %s-h, --help%s %sshow this help%s\n", cyan, reset, gray, reset)
|
||||
fmt.Fprintf(w, " %s-V, --version%s %sprint the version%s\n", cyan, reset, gray, reset)
|
||||
|
||||
Run "gasm <command> -h" for a command's usage and flags.
|
||||
fmt.Fprintf(w, "\nRun \"gasm <command> -h\" for a command's usage and flags.\n\n")
|
||||
|
||||
Examples:
|
||||
gasm fmt reformat every .s below the current directory
|
||||
gasm lint go-flac/*.s run static checks over the kernels
|
||||
gasm asm -o k.bin kern_amd64.s
|
||||
gasm asm --format elf -o k.o kern_amd64.s
|
||||
gasm asm --format goobj -p pkg/path -o k.o kern_amd64.s
|
||||
`, version)
|
||||
fmt.Fprintf(w, "%sExamples:%s\n", yellow, reset)
|
||||
examples := []struct{ cmd, desc string }{
|
||||
{"gasm fmt", "reformat every .s below the current directory"},
|
||||
{"gasm lint go-flac/*.s", "run static checks over the kernels"},
|
||||
{"gasm asm -o k.bin kern_amd64.s", ""},
|
||||
{"gasm asm --format elf -o k.o kern_amd64.s", ""},
|
||||
{"gasm asm --format goobj -p pkg/path -o k.o kern_amd64.s", ""},
|
||||
}
|
||||
for _, e := range examples {
|
||||
if e.desc != "" {
|
||||
fmt.Fprintf(w, " %s%s%s %s%s%s\n", cyan, e.cmd, reset, gray, e.desc, reset)
|
||||
} else {
|
||||
fmt.Fprintf(w, " %s%s%s\n", cyan, e.cmd, reset)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// newCommand returns the FlagSet of a subcommand whose -h/--help prints a
|
||||
|
||||
Reference in New Issue
Block a user