Skip to content

Commit

Permalink
docs: misc improvements, rephrasing
Browse files Browse the repository at this point in the history
Closes #6
  • Loading branch information
scop committed Nov 16, 2023
1 parent 6cc6f28 commit c68cd62
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 27 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,33 @@ with the same one command for multiple OS/architectures.
$ wrun -help
Usage of wrun:
-archive-exe-path value
[<OS>/<architecture>=]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
[<OS>/<architecture>=]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
Expand Down
4 changes: 2 additions & 2 deletions generate_setup_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 9 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
27 changes: 15 additions & 12 deletions wrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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", "[<OS>/<architecture>=]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, "://") {
Expand All @@ -155,7 +155,7 @@ func parseFlags(set *flag.FlagSet, args []string) (config, error) {
return nil
}
})
set.Func("archive-exe-path", "[<OS>/<architecture>=]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 == "" {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c68cd62

Please sign in to comment.