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:
parent
21bbc24c49
commit
62458e3553
@ -43,9 +43,6 @@ mut:
|
|||||||
struct Config {
|
struct Config {
|
||||||
mut:
|
mut:
|
||||||
pub_only bool = true
|
pub_only bool = true
|
||||||
is_local bool
|
|
||||||
local_filename string
|
|
||||||
local_pos int
|
|
||||||
show_loc bool // for plaintext
|
show_loc bool // for plaintext
|
||||||
is_multi bool
|
is_multi bool
|
||||||
is_vlib bool
|
is_vlib bool
|
||||||
@ -282,25 +279,15 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
|||||||
} else {
|
} else {
|
||||||
[cfg.input_path]
|
[cfg.input_path]
|
||||||
}
|
}
|
||||||
is_local_and_single := cfg.is_local && !cfg.is_multi
|
|
||||||
for dirpath in dirs {
|
for dirpath in dirs {
|
||||||
mut dcs := doc.Doc{}
|
|
||||||
vd.vprintln('Generating $out.typ docs for "$dirpath"')
|
vd.vprintln('Generating $out.typ docs for "$dirpath"')
|
||||||
if is_local_and_single {
|
mut dcs := doc.generate(dirpath, cfg.pub_only, true, cfg.symbol_name) or {
|
||||||
dcs = doc.generate_with_pos(dirpath, cfg.local_filename, cfg.local_pos) or {
|
|
||||||
vd.emit_generate_err(err)
|
vd.emit_generate_err(err)
|
||||||
exit(1)
|
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 {
|
if dcs.contents.len == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !is_local_and_single {
|
|
||||||
if cfg.is_multi || (!cfg.is_multi && cfg.include_readme) {
|
if cfg.is_multi || (!cfg.is_multi && cfg.include_readme) {
|
||||||
readme_contents := vd.get_readme(dirpath)
|
readme_contents := vd.get_readme(dirpath)
|
||||||
comment := doc.DocComment{
|
comment := doc.DocComment{
|
||||||
@ -316,7 +303,6 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
vd.docs << dcs
|
vd.docs << dcs
|
||||||
}
|
}
|
||||||
// Important. Let builtin be in the top of the module list
|
// Important. Let builtin be in the top of the module list
|
||||||
@ -390,11 +376,6 @@ fn parse_arguments(args []string) Config {
|
|||||||
'-all' {
|
'-all' {
|
||||||
cfg.pub_only = false
|
cfg.pub_only = false
|
||||||
}
|
}
|
||||||
'-filename' {
|
|
||||||
cfg.is_local = true
|
|
||||||
cfg.local_filename = cmdline.option(current_args, '-filename', '')
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
'-f' {
|
'-f' {
|
||||||
format := cmdline.option(current_args, '-f', '')
|
format := cmdline.option(current_args, '-f', '')
|
||||||
if format !in allowed_formats {
|
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) }
|
cfg.output_path = if opath == 'stdout' { opath } else { os.real_path(opath) }
|
||||||
i++
|
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' {
|
'-no-timestamp' {
|
||||||
cfg.no_timestamp = true
|
cfg.no_timestamp = true
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,7 @@ Options:
|
|||||||
to a file.
|
to a file.
|
||||||
-readme Include README.md to docs if present.
|
-readme Include README.md to docs if present.
|
||||||
-v Enables verbose logging. For debugging purposes.
|
-v Enables verbose logging. For debugging purposes.
|
||||||
-filename Specifies the specific file to document.
|
-no-timestamp Omits the timestamp in the output file.
|
||||||
-pos Specifies the position. Used with `-filename`.
|
|
||||||
-no-timestamp Omit timestamp in the output file.
|
|
||||||
|
|
||||||
For HTML mode:
|
For HTML mode:
|
||||||
-inline-assets Embeds the contents of the CSS and JS assets into the webpage directly.
|
-inline-assets Embeds the contents of the CSS and JS assets into the webpage directly.
|
||||||
|
Loading…
Reference in New Issue
Block a user