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

vdoc: remove local mode (#9282)

This commit is contained in:
Ned Palacios 2021-03-13 13:49:03 +08:00 committed by GitHub
parent 21bbc24c49
commit 62458e3553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 44 deletions

View File

@ -43,9 +43,6 @@ mut:
struct Config {
mut:
pub_only bool = true
is_local bool
local_filename string
local_pos int
show_loc bool // for plaintext
is_multi bool
is_vlib bool
@ -282,25 +279,15 @@ fn (mut vd VDoc) generate_docs_from_file() {
} else {
[cfg.input_path]
}
is_local_and_single := cfg.is_local && !cfg.is_multi
for dirpath in dirs {
mut dcs := doc.Doc{}
vd.vprintln('Generating $out.typ docs for "$dirpath"')
if is_local_and_single {
dcs = doc.generate_with_pos(dirpath, cfg.local_filename, cfg.local_pos) or {
mut dcs := doc.generate(dirpath, cfg.pub_only, true, cfg.symbol_name) or {
vd.emit_generate_err(err)
exit(1)
}
} else {
dcs = doc.generate(dirpath, cfg.pub_only, true, cfg.symbol_name) or {
vd.emit_generate_err(err)
exit(1)
}
}
if dcs.contents.len == 0 {
continue
}
if !is_local_and_single {
if cfg.is_multi || (!cfg.is_multi && cfg.include_readme) {
readme_contents := vd.get_readme(dirpath)
comment := doc.DocComment{
@ -316,7 +303,6 @@ fn (mut vd VDoc) generate_docs_from_file() {
}
}
}
}
vd.docs << dcs
}
// Important. Let builtin be in the top of the module list
@ -390,11 +376,6 @@ fn parse_arguments(args []string) Config {
'-all' {
cfg.pub_only = false
}
'-filename' {
cfg.is_local = true
cfg.local_filename = cmdline.option(current_args, '-filename', '')
i++
}
'-f' {
format := cmdline.option(current_args, '-f', '')
if format !in allowed_formats {
@ -419,14 +400,6 @@ fn parse_arguments(args []string) Config {
cfg.output_path = if opath == 'stdout' { opath } else { os.real_path(opath) }
i++
}
'-pos' {
if !cfg.is_local {
eprintln('vdoc: `-pos` is only allowed with `-filename` flag.')
exit(1)
}
cfg.local_pos = cmdline.option(current_args, '-pos', '').int()
i++
}
'-no-timestamp' {
cfg.no_timestamp = true
}

View File

@ -22,9 +22,7 @@ Options:
to a file.
-readme Include README.md to docs if present.
-v Enables verbose logging. For debugging purposes.
-filename Specifies the specific file to document.
-pos Specifies the position. Used with `-filename`.
-no-timestamp Omit timestamp in the output file.
-no-timestamp Omits the timestamp in the output file.
For HTML mode:
-inline-assets Embeds the contents of the CSS and JS assets into the webpage directly.