1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vdoc: support -os and show docs according to the platform (#9474)

This commit is contained in:
Swastik Baranwal
2021-03-27 14:20:06 +05:30
committed by GitHub
parent 762036963c
commit 0e254e0329
5 changed files with 98 additions and 7 deletions

View File

@ -57,6 +57,7 @@ mut:
output_type OutputType = .unset
input_path string
symbol_name string
platform doc.Platform
}
//
@ -292,7 +293,7 @@ fn (mut vd VDoc) generate_docs_from_file() {
}
for dirpath in dirs {
vd.vprintln('Generating $out.typ docs for "$dirpath"')
mut dcs := doc.generate(dirpath, cfg.pub_only, true, cfg.symbol_name) or {
mut dcs := doc.generate(dirpath, cfg.pub_only, true, cfg.platform, cfg.symbol_name) or {
vd.emit_generate_err(err)
exit(1)
}
@ -419,6 +420,19 @@ fn parse_arguments(args []string) Config {
cfg.output_path = if opath == 'stdout' { opath } else { os.real_path(opath) }
i++
}
'-os' {
platform_str := cmdline.option(current_args, '-os', '')
if platform_str == 'cross' {
eprintln('`v doc -os cross` is not supported yet.')
exit(1)
}
selected_platform := doc.platform_from_string(platform_str) or {
eprintln(err.msg)
exit(1)
}
cfg.platform = selected_platform
i++
}
'-no-timestamp' {
cfg.no_timestamp = true
}