Updated install command.
This commit is contained in:
parent
bb812914d1
commit
b267ddf8b5
1 changed files with 47 additions and 35 deletions
22
bur.v
22
bur.v
|
|
@ -1,4 +1,6 @@
|
||||||
import os
|
import os
|
||||||
|
import net.http
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
args := os.args
|
args := os.args
|
||||||
|
|
||||||
|
|
@ -6,14 +8,25 @@ fn main(){
|
||||||
println('commands: bur [install|update|remove]')
|
println('commands: bur [install|update|remove]')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cmd := os.args[1]
|
|
||||||
|
cmd := args[1]
|
||||||
|
|
||||||
match cmd {
|
match cmd {
|
||||||
'install' { install_function()}
|
'install' {
|
||||||
|
if args.len < 3 {
|
||||||
|
println('error: please provide a package name')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
install_function(args[2])
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
println('unknown command')
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
fn install_function(name string) {
|
fn install_function(name string) {
|
||||||
url := 'insert when its built'
|
url := 'needtoadd' + name + '.c'
|
||||||
|
|
||||||
resp := http.get(url) or {
|
resp := http.get(url) or {
|
||||||
println('error couldnt connect to server sorry!!;')
|
println('error couldnt connect to server sorry!!;')
|
||||||
|
|
@ -37,7 +50,6 @@ fn install_function(name string) {
|
||||||
|
|
||||||
if res.exit_code == 0 {
|
if res.exit_code == 0 {
|
||||||
println('boringly compiled $name.elf run $name in your terminal to run')
|
println('boringly compiled $name.elf run $name in your terminal to run')
|
||||||
|
|
||||||
os.rm('/tmp/$name.c') or { }
|
os.rm('/tmp/$name.c') or { }
|
||||||
} else {
|
} else {
|
||||||
println('oh crud $name failed to compile!')
|
println('oh crud $name failed to compile!')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue