the base
This commit is contained in:
@@ -3,6 +3,34 @@
|
||||
import os
|
||||
import flag
|
||||
|
||||
fn addtoscript(tofind string, toadd string) ! {
|
||||
home_dir := os.home_dir()
|
||||
mut rc_file := '${home_dir}/.zshrc'
|
||||
if !os.exists(rc_file) {
|
||||
rc_file = '${home_dir}/.bashrc'
|
||||
if !os.exists(rc_file) {
|
||||
return error('No .zshrc or .bashrc found in home directory')
|
||||
}
|
||||
}
|
||||
|
||||
// Read current content
|
||||
mut content := os.read_file(rc_file)!
|
||||
|
||||
// Remove existing alias if present
|
||||
lines := content.split('\n')
|
||||
mut new_lines := []string{}
|
||||
for line in lines {
|
||||
if !line.contains(tofind) {
|
||||
new_lines << line
|
||||
}
|
||||
}
|
||||
new_lines << toadd
|
||||
// Write back to file
|
||||
new_content := new_lines.join('\n')
|
||||
os.write_file(rc_file, new_content)!
|
||||
}
|
||||
|
||||
|
||||
vroot := @VROOT
|
||||
abs_dir_of_script := dir(@FILE)
|
||||
|
||||
@@ -18,8 +46,15 @@ os.mkdir_all('${os.home_dir()}/.vmodules/freeflowuniverse') or {
|
||||
}
|
||||
|
||||
// Create new symlinks
|
||||
os.symlink('${abs_dir_of_script}/herolib', '${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {
|
||||
os.symlink('${abs_dir_of_script}/lib', '${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {
|
||||
panic('Failed to create herolib symlink: ${err}')
|
||||
}
|
||||
|
||||
println('Herolib installation completed successfully!')
|
||||
|
||||
// Add vtest alias
|
||||
addtoscript('vtest ', 'alias vtest \'v -stats -enable-globals -n -w -gc none -no-retry-compilation -cc tcc test\' %') or {
|
||||
eprintln('Failed to add vtest alias: ${err}')
|
||||
}
|
||||
|
||||
println('Added vtest alias to shell configuration')
|
||||
|
||||
Reference in New Issue
Block a user