✨ file を検索する機能の追加
This commit is contained in:
parent
f77aa916de
commit
2579bda3d8
1 changed files with 24 additions and 10 deletions
28
vss.v
28
vss.v
|
@ -2,15 +2,18 @@ module main
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import cli
|
import cli
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
mut app := cli.Command {
|
mut app := cli.Command{
|
||||||
name: "vss"
|
name: 'vss'
|
||||||
version: "0.0.0"
|
version: '0.0.0'
|
||||||
description: "static site generator"
|
description: 'static site generator'
|
||||||
execute: fn (cmd cli.Command) ? {
|
execute: fn (cmd cli.Command) ? {
|
||||||
|
paths := get_paths("docs")
|
||||||
|
for path in paths {
|
||||||
|
println(path)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +21,18 @@ fn main() {
|
||||||
text := '# Markdown Rocks!'
|
text := '# Markdown Rocks!'
|
||||||
output := markdown.to_html(text)
|
output := markdown.to_html(text)
|
||||||
println(output) // <h1>Markdown Rocks!</h1>
|
println(output) // <h1>Markdown Rocks!</h1>
|
||||||
|
|
||||||
|
app.setup()
|
||||||
|
app.parse(os.args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// work の検証をやる
|
fn normalise_paths(paths []string) []string {
|
||||||
https://modules.vlang.io/os.html#walk
|
mut res := paths.map(it.replace(os.path_separator, '/'))
|
||||||
|
res.sort()
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_paths(path string) []string {
|
||||||
|
mds := os.walk_ext(path, '.md')
|
||||||
|
return mds
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue