feat(cli): add aur search command

Jef Roosens 2022-06-22 16:19:07 +02:00 committed by Chewing_Bever
parent 1b7cabdd74
commit 487b235727
Signed by untrusted user: Jef Roosens
GPG Key ID: B75D4F293C7052DB
4 changed files with 33 additions and 1 deletions

3
.gitignore vendored
View File

@ -27,3 +27,6 @@ gdb.txt
# Generated docs # Generated docs
_docs/ _docs/
/man/ /man/
# VLS logs
vls.log

View File

@ -0,0 +1,26 @@
module aur
import cli
import console
import vieter_v.aur
pub fn cmd() cli.Command {
return cli.Command{
name: 'aur'
description: 'Interact with the AUR.'
commands: [
cli.Command{
name: 'search'
description: 'Search for packages.'
required_args: 1
execute: fn (cmd cli.Command) ? {
c := aur.new()
pkgs := c.search(cmd.args[0])?
data := pkgs.map([it.name, it.description])
println(console.pretty_table(['name', 'description'], data)?)
}
},
]
}
}

View File

@ -7,6 +7,7 @@ import console.targets
import console.logs import console.logs
import console.schedule import console.schedule
import console.man import console.man
import console.aur
import cron import cron
fn main() { fn main() {
@ -31,6 +32,7 @@ fn main() {
logs.cmd(), logs.cmd(),
schedule.cmd(), schedule.cmd(),
man.cmd(), man.cmd(),
aur.cmd(),
] ]
} }
app.setup() app.setup()

View File

@ -1,6 +1,7 @@
Module { Module {
dependencies: [ dependencies: [
'https://git.rustybever.be/vieter-v/conf', 'https://git.rustybever.be/vieter-v/conf',
'https://git.rustybever.be/vieter-v/docker' 'https://git.rustybever.be/vieter-v/docker',
'https://git.rustybever.be/vieter-v/aur'
] ]
} }