From 231426c73e70c58fed3e90826b9d58c7515ea252 Mon Sep 17 00:00:00 2001 From: wangjin Date: Sun, 13 Oct 2024 16:15:05 +0800 Subject: [PATCH] fix Makefile --- Makefile | 1 - src/compile/next.go | 8 ++++---- website/example/gen/rust/Cargo.toml | 8 -------- website/example/gen/rust/src/main.rs | 3 --- 4 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 website/example/gen/rust/Cargo.toml delete mode 100644 website/example/gen/rust/src/main.rs diff --git a/Makefile b/Makefile index 57b7d3b..be483d6 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,6 @@ example/clean: example/gen: @echo "Running generate example..." @NEXT_NOCOPYBUILTIN=1 ${BUILD_BIN_DIR}/next build ${EXAMPLE_DIR} - @if [ -d ${EXAMPLE_DIR}/gen/rust ]; then cd ${EXAMPLE_DIR}/gen/rust && cargo init --vcs none -q; fi .PHONY: clean clean: diff --git a/src/compile/next.go b/src/compile/next.go index ff478c4..f76c2d9 100644 --- a/src/compile/next.go +++ b/src/compile/next.go @@ -180,7 +180,7 @@ var commands = map[string]*command{ // **.nextproj** is recommended for the Next project file. // ::: "build": newCommand( - "Run a next project: next build [file_or_dirs...]", + "Build a next project: next build [file_or_dirs...]", func(ctx *commandContext, args []string) error { if len(args) == 1 { args = append(args, ".") @@ -262,7 +262,7 @@ func Compile(platform Platform, builtin FileSystem, args []string) { } } - flagSet := flag.NewFlagSet(args[0], flag.ContinueOnError) + flagSet := flag.NewFlagSet(op.If(runtime.GOOS == "windows", "next", args[0]), flag.ContinueOnError) flagSet.Usage = func() {} stdin, stderr := platform.Stdin(), platform.Stderr() @@ -273,12 +273,12 @@ func Compile(platform Platform, builtin FileSystem, args []string) { flagSet.SetOutput(term.ColorizeWriter(stderr, term.Red)) usageFunc := func() { flagSet.SetOutput(stderr) - name := term.Bold.Colorize(op.If(runtime.GOOS == "windows", "next", args[0])) + name := term.Bold.Colorize(flagSet.Name()) term.Fprint(flagSet.Output(), "Next is an IDL for generating customized code across multiple languages.\n\n") term.Fprint(flagSet.Output(), "Usage:\n") term.Fprintf(flagSet.Output(), " %s [Options] [source_dirs_or_files...] (default: current directory)\n", name) term.Fprintf(flagSet.Output(), " %s [Options] \n", name) - term.Fprintf(flagSet.Output(), " %s [Command-Args]\n", name) + term.Fprintf(flagSet.Output(), " %s ...\n", name) term.Fprintf(flagSet.Output(), "\nCommands:\n") var maxCommandLength int diff --git a/website/example/gen/rust/Cargo.toml b/website/example/gen/rust/Cargo.toml deleted file mode 100644 index 1ec6963..0000000 --- a/website/example/gen/rust/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "rust" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/website/example/gen/rust/src/main.rs b/website/example/gen/rust/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/website/example/gen/rust/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -}