Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated man pages #2004

Merged
merged 3 commits into from
Sep 22, 2022
Merged

Updated man pages #2004

merged 3 commits into from
Sep 22, 2022

Conversation

tDwtp
Copy link
Contributor

@tDwtp tDwtp commented Sep 22, 2022

update the man pages based on the output of --help of the individual commands

update the man pages based on the output of `--help`
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way to automate this?

@tDwtp
Copy link
Contributor Author

tDwtp commented Sep 22, 2022

You can definetly parse the output of the --help for this.
Actually, I wrote a little script to help me, but its in Lua. (I was lazy and did it in like 10 minutes flat with CTRL+C).

Also: I want to expand the OptionParser parser("wabt-tool", s_description); stuff, to include proper description so it is distinguished from the short description. Would that be ok?

Format:
usage: <usage>
<short-description> one liner; no indentation
\n
  full description
  indented by 2 spaces!
\n
examples:
  # sample-description
  # may span multiple lines
  $ sample input
\n
options:
  -x, --xyz     two (2) spaces indention for "multi-option"
      --abx     six (6) spaces indention for "single-option"
The Lua-script:
local line = ""
repeat
	line = io.read('*line');
until line == "options:"

local FULL = "^      %-%-"
local SHORT = "^  %-(.), %-%-"
local R_FULL = ".It Fl Fl "
local R_SHORT = ".It Fl %1 , Fl Fl "

for line in io.stdin:lines() do
	if line:match("^ +%-") then
		local parsed = line:match(FULL) and
			line:gsub(FULL, R_FULL) or
			line:gsub(SHORT, R_SHORT)
		print((parsed:gsub("   +", '\n')))
	else
		print(line)
	end
end

P.S.: I would like to add the option -m, --module=[NAME:]PATH use PATH as a wasm module and provide all exports under the name NAME (filename if not present) for imports
Later maybe dlopen/GetModuleHandle could be supported? you could simply write your own wasi and wasi will just export wasi.[dll|so] and start the function, done. easily replacable wasi runtime. good for experimentation.

Added a lua script to generate man pages from help messages see WebAssembly#2004 for the format used.
usage: `wabt-tool --help | lua help2man.lau`
help2man.lua Outdated Show resolved Hide resolved
Added the shebang and moved the Lua-script into the scripts folder
@sbc100 sbc100 enabled auto-merge (squash) September 22, 2022 17:46
@sbc100 sbc100 merged commit 520614a into WebAssembly:main Sep 22, 2022
matthias-blume pushed a commit to matthias-blume/wabt that referenced this pull request Dec 16, 2022
update the man pages based on the output of `--help`

Added a lua script to generate man pages from help messages:
usage: `wabt-tool --help | lua help2man.lau`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants