diff --git a/README.md b/README.md index 0c5fb22..3678e2c 100644 --- a/README.md +++ b/README.md @@ -7,30 +7,33 @@ with the same one command for multiple OS/architectures. $ wrun -help Usage of wrun: -archive-exe-path value - [/=]path to executable within archive (separator always /, implies archive processing) + [OS/arch=]path to executable within archive matcher (separator always /, implies archive processing) -http-timeout duration HTTP client timeout (default 5m0s) -url value - [/=]URL (at least one required) + [OS/arch=]URL matcher (at least one required) -use-pre-commit-cache Use pre-commit's cache dir wrun downloads, caches, and runs executables. -The same one command works for multiple OS/architectures. -The OS and architecture wrun was built for are matched against the given URL matchers. -The first matching one in the order given is chosen as the URL to download. -The matcher OS and architecture may be globs. -As a special case, a plain URL with no matcher part is treated as if it was given with the matcher */*. -URL fragments are treated as hashAlgo-hexDigest strings, and downloads are checked against them. +OS and architecture matcher arguments for URLs to download and (if applicable) executables within archives can be used to construct command lines that work across multiple operating systems and architectures. + +The OS and architecture wrun was built for are matched against the given matchers. +OS and architecture parts of the matcher may be globs. +Order of the matcher arguments is significant: the first match of each is chosen. + +As a special case, a matcher argument with no matcher part is treated as if it was given with the matcher */*. + +URL fragments, if present, are treated as hashAlgo-hexDigest strings, and downloads are checked against them. The first non-flag argument or -- terminates wrun arguments. Remaining ones are passed to the downloaded one. Environment variables: -- WRUN_CACHE_HOME: location of the cache, defaults to wrun in the user cache dir -- WRUN_VERBOSE: controls output verbosity; false decreases, true increases -- WRUN_OS_ARCH: override OS/architecture for URL and archive exe path matching +- WRUN_CACHE_HOME: cache location, defaults to wrun subdir in the user cache dir +- WRUN_OS_ARCH: override OS/arch for matching +- WRUN_VERBOSE: output verbosity, false decreases, true increases ``` ## Installation diff --git a/generate_setup_cfg.py b/generate_setup_cfg.py index 84092d0..932b0a5 100755 --- a/generate_setup_cfg.py +++ b/generate_setup_cfg.py @@ -11,7 +11,7 @@ [metadata] name = wrun_py version = ${pkg_version} -description = Python wrapper around invoking wrun (https://github.com/scop/wrun) +description = Web executable launcher long_description = file: README.md long_description_content_type = text/markdown url = https://github.com/scop/wrun @@ -26,7 +26,7 @@ Operating System :: MacOS Operating System :: Microsoft :: Windows Operating System :: POSIX :: Linux - Programming Language :: Python :: 3 + Programming Language :: Go Topic :: Internet :: WWW/HTTP Topic :: Utilities diff --git a/setup.cfg b/setup.cfg index 2c693c8..b8aac93 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = wrun_py version = 0.0.1-1 -description = Python wrapper around invoking wrun (https://github.com/scop/wrun) +description = Web executable launcher long_description = file: README.md long_description_content_type = text/markdown url = https://github.com/scop/wrun @@ -10,8 +10,15 @@ author_email = ville.skytta@iki.fi license = Apache License 2.0 license_files = LICENSE classifiers = - License :: OSI Approved :: MIT License + Development Status :: 4 - Beta + Intended Audience :: Developers + License :: OSI Approved :: Apache Software License + Operating System :: MacOS + Operating System :: Microsoft :: Windows + Operating System :: POSIX :: Linux Programming Language :: Python :: 3 + Topic :: Internet :: WWW/HTTP + Topic :: Utilities [options] python_requires = >=3.8 diff --git a/wrun.go b/wrun.go index 4b71262..82eb778 100644 --- a/wrun.go +++ b/wrun.go @@ -135,7 +135,7 @@ type config struct { func parseFlags(set *flag.FlagSet, args []string) (config, error) { cfg := config{} cfg.urlMatches = make([]urlMatch, 0, len(args)/2+3) - set.Func("url", "[/=]URL (at least one required)", func(s string) error { + set.Func("url", "[OS/arch=]URL matcher (at least one required)", func(s string) error { pattern, ur, found := strings.Cut(s, "=") if found { if strings.Contains(pattern, "://") { @@ -155,7 +155,7 @@ func parseFlags(set *flag.FlagSet, args []string) (config, error) { return nil } }) - set.Func("archive-exe-path", "[/=]path to executable within archive (separator always /, implies archive processing)", func(s string) error { + set.Func("archive-exe-path", "[OS/arch=]path to executable within archive matcher (separator always /, implies archive processing)", func(s string) error { pattern, pth, found := strings.Cut(s, "=") if found { if pattern == "" { @@ -295,22 +295,25 @@ func main() { if errors.Is(err, flag.ErrHelp) { fmt.Printf(` %s downloads, caches, and runs executables. -The same one command works for multiple OS/architectures. -The OS and architecture wrun was built for are matched against the given URL matchers. -The first matching one in the order given is chosen as the URL to download. -The matcher OS and architecture may be globs. -As a special case, a plain URL with no matcher part is treated as if it was given with the matcher */*. -URL fragments are treated as hashAlgo-hexDigest strings, and downloads are checked against them. +OS and architecture matcher arguments for URLs to download and (if applicable) executables within archives can be used to construct command lines that work across multiple operating systems and architectures. + +The OS and architecture wrun was built for are matched against the given matchers. +OS and architecture parts of the matcher may be globs. +Order of the matcher arguments is significant: the first match of each is chosen. + +As a special case, a matcher argument with no matcher part is treated as if it was given with the matcher */*. + +URL fragments, if present, are treated as hashAlgo-hexDigest strings, and downloads are checked against them. The first non-flag argument or -- terminates %s arguments. Remaining ones are passed to the downloaded one. Environment variables: -- %s: location of the cache, defaults to %s in the user cache dir -- %s: controls output verbosity; false decreases, true increases -- %s: override OS/architecture for URL and archive exe path matching -`, prog, prog, cacheHomeEnvVar, prog, verboseEnvVar, osArchEnvVar) +- %s: cache location, defaults to wrun subdir in the user cache dir +- %s: override OS/arch for matching +- %s: output verbosity, false decreases, true increases +`, prog, prog, cacheHomeEnvVar, osArchEnvVar, verboseEnvVar) } else { // Error already printed rc = 2 // usage