Updated install command.

This commit is contained in:
chersbobers 2026-05-12 22:12:54 +12:00
parent bb812914d1
commit b267ddf8b5

82
bur.v
View file

@ -1,46 +1,58 @@
import os
fn main(){
args := os.args
import net.http
if args.len < 2 {
println('commands: bur [install|update|remove]')
return
}
cmd := os.args[1]
match cmd {
'install' { install_function()}
}
fn main() {
args := os.args
if args.len < 2 {
println('commands: bur [install|update|remove]')
return
}
cmd := args[1]
match cmd {
'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) {
url := 'insert when its built'
url := 'needtoadd' + name + '.c'
resp := http.get(url) or {
println('error couldnt connect to server sorry!!;')
return
}
resp := http.get(url) or {
println('error couldnt connect to server sorry!!;')
return
}
if resp.status_code != 200 {
println('error package $name not found! 404')
return
}
if resp.status_code != 200 {
println('error package $name not found! 404')
return
}
os.write_file('/tmp/$name.c', resp.body) or {
println('error failed writing to tmp ')
return
}
os.write_file('/tmp/$name.c', resp.body) or {
println('error failed writing to tmp ')
return
}
println('boringly compiling $name')
println('boringly compiling $name')
compile_cmd := 'tcc /tmp/$name.c -o /bin/$name.elf'
res := os.execute(compile_cmd)
compile_cmd := 'tcc /tmp/$name.c -o /bin/$name.elf'
res := os.execute(compile_cmd)
if res.exit_code == 0 {
println('boringly compiled $name.elf run $name in your terminal to run')
os.rm('/tmp/$name.c') or { }
} else {
println('oh crud $name failed to compile!')
println(res.output)
}
if res.exit_code == 0 {
println('boringly compiled $name.elf run $name in your terminal to run')
os.rm('/tmp/$name.c') or { }
} else {
println('oh crud $name failed to compile!')
println(res.output)
}
}