~eliasnaur/gio

44c7be6750e6de233bd2e96fc4a640f2d37276e0 — Elias Naur 6 months ago 470478e
cmd/gio: expand usage document

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2 files changed, 56 insertions(+), 5 deletions(-)

M cmd/gio/gio.go
A cmd/gio/help.go
M cmd/gio/gio.go => cmd/gio/gio.go +5 -5
@@ 23,10 23,10 @@ import (
)

var (
	target        = flag.String("target", "", "specify target (ios, tvos, android, js)")
	archNames     = flag.String("arch", "", "specify architecture(s) to include")
	buildMode     = flag.String("buildmode", "exe", "specify buildmode: archive or exe")
	destPath      = flag.String("o", "", `output path. Specify a path with the ".app" suffix for iOS simulators.`)
	target        = flag.String("target", "", "specify target (ios, tvos, android, js).\n")
	archNames     = flag.String("arch", "", "specify architecture(s) to include (arm, arm64, amd64).")
	buildMode     = flag.String("buildmode", "exe", "specify buildmode (archive, exe)")
	destPath      = flag.String("o", "", "output file or directory.\nFor -target ios or tvos, use the .app suffix to target simulators.")
	appID         = flag.String("appid", "org.gioui.app", "app identifier (for -buildmode=exe)")
	version       = flag.Int("version", 1, "app version (for -buildmode=exe)")
	printCommands = flag.Bool("x", false, "print the commands")


@@ 46,7 46,7 @@ type buildInfo struct {

func main() {
	flag.Usage = func() {
		mainUsage(os.Stderr)
		fmt.Fprintf(os.Stderr, mainUsage)
	}
	flag.Parse()
	if err := mainErr(); err != nil {

A cmd/gio/help.go => cmd/gio/help.go +51 -0
@@ 0,0 1,51 @@
// SPDX-License-Identifier: Unlicense OR MIT

package main

const mainUsage = `The Gio command builds and packages Gio (gioui.org) programs.

Usage:

	gio -target <target> [flags] <package> [run arguments]

The go tool is sufficient to build, install and run Gio programs on platforms
where a single executable is sufficient. The gio tool can build and package Gio
programs for platforms where additional metadata or support files are required.

The package argument specifies an import path or a single Go source file to
package. Any run arguments are appended to os.Args at runtime.

If the package contains an appicon.png file, it is used as the app icon on
supported platforms.

The mandatory -target flag selects the target platform: ios or android for the
mobile platforms, tvos for Apple's tvOS, js for WebAssembly/WebGL.

The -arch flag specifies a comma separated list of GOARCHs to include. The
default is all supported architectures.

The -o flag specifies an output file or directory, depending on the target.

The -buildmode flag selects the build mode. Two build modes are available, exe
and archive. Buildmode exe outputs an .ipa file for iOS or tvOS, an .apk file
for Android or a directory with the WebAssembly module and support files for
a browser.

As a special case for iOS or tvOS, specifying a path that ends with ".app"
will output an app directory suitable for a simulator.

The other buildmode is archive, which will output an .aar library for Android
or a .framework for iOS and tvOS.

The -appid flag specifies the package name for Android or the bundle id for
iOS and tvOS. A bundle id must be provisioned through Xcode before the gio
tool can use it.

The -version flag specifies the integer version for Android and the last
component of the 1.0.X version for iOS and tvOS.

The -work flag prints the path to the working directory and suppress
its deletion.

The -x flag will print all the external commands executed by the gio tool.
`