Skip to content

Commit

Permalink
v.help: add download.txt, so that v help download works too, cleanu…
Browse files Browse the repository at this point in the history
…p help.v
  • Loading branch information
spytheman committed Nov 14, 2024
1 parent ee3a182 commit 9d97e18
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vlib/v/help/help.v
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ fn print_topic_unknown(topic string) {
}

fn print_known_topics() {
mut res := 'Known help topics: '
topic_paths := os.walk_ext(help_dir(), '.txt')
for i, path in topic_paths {
mut res := []string{}
for path in topic_paths {
topic := os.file_name(path).all_before('.txt')
if topic != 'default' {
res += topic + if i != topic_paths.len - 1 { ', ' } else { '.' }
res << topic
}
}
println(res)
println('Known help topics: ${res.sorted()}')
}

fn get_vexe() string {
Expand Down
19 changes: 19 additions & 0 deletions vlib/v/help/other/download.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
vdownload 0.0.1
-----------------------------------------------
Usage: vdownload [options] URL1 URL2 ...

Description: Download files from http/https servers, given their URLs.

The arguments should be at least 1 in number.

Options:
-h, --help Show this help screen.
-t, --target-folder <string>
The target folder, where the file will be stored. It will be created, if it does not exist. Default is current folder.
-1, --sha1 Show the SHA1 hash of the downloaded file.
-2, --sha256 Show the SHA256 hash of the downloaded file.
-c, --continue Continue on download failures. If you download 5 URLs, and several of them fail, continue without error. False by default.
-r, --retries <int> Number of retries, when an URL fails to download.
-d, --delay <float> Delay in seconds, after each retry.
-R, --run Run, after the script/program is completely downloaded.
-D, --delete-after-run Delete the downloaded script/program, after it has been run.

0 comments on commit 9d97e18

Please sign in to comment.