formatting

This commit is contained in:
2024-12-30 17:36:22 +02:00
parent 4858178f52
commit f0fdf146a8
141 changed files with 1850 additions and 1882 deletions

View File

@@ -8,17 +8,19 @@ mut silent := false
coderoot := if 'CODEROOT' in os.environ() {
os.environ()['CODEROOT']
} else {os.join_path(os.home_dir(), 'code')}
} else {
os.join_path(os.home_dir(), 'code')
}
mut gs := gittools.get()!
if coderoot.len > 0 {
//is a hack for now
// is a hack for now
gs = gittools.new(coderoot: coderoot)!
}
mypath := gs.do(
recursive: true
cmd: 'list'
cmd: 'list'
)!
timer := performance.new('gittools')

View File

@@ -4,7 +4,6 @@ import freeflowuniverse.herolib.develop.gittools
import freeflowuniverse.herolib.osal
import time
mut gs_default := gittools.new()!
println(gs_default)

View File

@@ -5,7 +5,7 @@ import freeflowuniverse.herolib.osal
import time
// Creates a new file in the specified repository path and returns its name.
fn create_new_file(repo_path string, runtime i64)! string {
fn create_new_file(repo_path string, runtime i64) !string {
coded_now := time.now().unix()
file_name := 'hello_world_${coded_now}.py'
println('Creating a new ${file_name} file.')
@@ -29,8 +29,8 @@ mut repo := gs_default.get_repo(name: 'repo3')!
// mut repo := gs_default.get_repo(name: 'repo3' clone: true, url: 'https://github.com/Mahmoud-Emad/repo2.git')!
runtime := time.now().unix()
branch_name := "branch_${runtime}"
tag_name := "tag_${runtime}"
branch_name := 'branch_${runtime}'
tag_name := 'tag_${runtime}'
repo_path := repo.get_path()!
mut file_name := create_new_file(repo_path, runtime)!
@@ -51,36 +51,28 @@ repo.checkout(branch_name: branch_name, pull: false) or {
// Check for changes and stage them if present.
if repo.has_changes()! {
println('Adding the changes...')
repo.add_changes() or {
error('Cannot add the changes due to: ${err}')
}
repo.add_changes() or { error('Cannot add the changes due to: ${err}') }
}
// Check if a commit is needed and commit changes if necessary.
if repo.need_commit()! {
commit_msg := 'feat: Added ${file_name} file.'
println('Committing the changes, Commit message: ${commit_msg}.')
repo.commit(msg: commit_msg) or {
error('Cannot commit the changes due to: ${err}')
}
repo.commit(msg: commit_msg) or { error('Cannot commit the changes due to: ${err}') }
}
// Push changes to the remote repository if necessary.
if repo.need_push()! {
println('Pushing the changes...')
repo.push() or {
error('Cannot push the changes due to: ${err}')
}
repo.push() or { error('Cannot push the changes due to: ${err}') }
}
if repo.need_pull()! {
println('Pulling the changes.')
repo.pull() or {
error('Cannot pull the changes due to: ${err}')
}
repo.pull() or { error('Cannot pull the changes due to: ${err}') }
}
// Checkout to the base branch
// Checkout to the base branch
repo.checkout(checkout_to_base_branch: true, pull: true) or {
error("Couldn't checkout to branch ${branch_name} due to: ${err}")
}
@@ -93,12 +85,8 @@ repo.create_tag(tag_name: tag_name, checkout: false) or {
// Push the created tag.
println('Pushing the tag...')
repo.push(push_tag: true) or {
error('Cannot push the tag due to: ${err}')
}
repo.push(push_tag: true) or { error('Cannot push the tag due to: ${err}') }
// Check if the created tag exists.
println('Check if the created tag exists...')
repo.is_tag_exists(tag_name: tag_name) or {
println("Tag isn't exists.")
}
repo.is_tag_exists(tag_name: tag_name) or { println("Tag isn't exists.") }

View File

@@ -8,16 +8,16 @@ import veb
osal.load_env_file('${os.dir(@FILE)}/.env')!
mut j := juggler.configure(
url: 'https://git.ourworld.tf/projectmycelium/itenv'
url: 'https://git.ourworld.tf/projectmycelium/itenv'
username: os.getenv('JUGGLER_USERNAME')
password: os.getenv('JUGGLER_PASSWORD')
reset: true
reset: true
)!
spawn j.run(8000)
println(j.info())
for{}
for {}
// TODO
// - automate caddy install/start

View File

@@ -5,11 +5,13 @@ import os
mut sm := startupmanager.get()!
sm.start(
name: 'juggler'
cmd: 'hero juggler -secret planetfirst -u https://git.ourworld.tf/projectmycelium/itenv -reset true'
env: {'HOME': os.home_dir()}
name: 'juggler'
cmd: 'hero juggler -secret planetfirst -u https://git.ourworld.tf/projectmycelium/itenv -reset true'
env: {
'HOME': os.home_dir()
}
restart: true
) or {panic('failed to start sm ${err}')}
) or { panic('failed to start sm ${err}') }
// TODO
// - automate caddy install/start

View File

@@ -3,26 +3,26 @@
import freeflowuniverse.herolib.develop.luadns
fn main() {
mut lua_dns := luadns.load('https://github.com/Incubaid/dns') or {
eprintln('Failed to parse LuaDNS files: $err')
return
}
mut lua_dns := luadns.load('https://github.com/Incubaid/dns') or {
eprintln('Failed to parse LuaDNS files: ${err}')
return
}
lua_dns.set_domain('test.protocol.me', '65.21.132.119') or {
eprintln('Failed to set domain: $err')
return
}
lua_dns.set_domain('test.protocol.me', '65.21.132.119') or {
eprintln('Failed to set domain: ${err}')
return
}
lua_dns.set_domain('example.protocol.me', '65.21.132.119') or {
eprintln('Failed to set domain: $err')
return
}
for config in lua_dns.configs {
println(config)
}
for config in lua_dns.configs {
println(config)
}
lua_dns.set_domain('example.protocol.me', '65.21.132.119') or {
eprintln('Failed to set domain: ${err}')
return
}
for config in lua_dns.configs {
println(config)
}
for config in lua_dns.configs {
println(config)
}
}

View File

@@ -5,7 +5,7 @@ import freeflowuniverse.herolib.clients.openai as op
mut ai_cli := op.new()!
mut msg := []op.Message{}
msg << op.Message{
role: op.RoleType.user
role: op.RoleType.user
content: 'Say this is a test!'
}
mut msgs := op.Messages{
@@ -19,26 +19,26 @@ models := ai_cli.list_models()!
model := ai_cli.get_model(models.data[0].id)!
print(model)
images_created := ai_cli.create_image(op.ImageCreateArgs{
prompt: 'Calm weather'
prompt: 'Calm weather'
num_images: 2
size: op.ImageSize.size_512_512
format: op.ImageRespType.url
size: op.ImageSize.size_512_512
format: op.ImageRespType.url
})!
print(images_created)
images_updated := ai_cli.create_edit_image(op.ImageEditArgs{
image_path: '/path/to/image.png'
mask_path: '/path/to/mask.png'
prompt: 'Calm weather'
mask_path: '/path/to/mask.png'
prompt: 'Calm weather'
num_images: 2
size: op.ImageSize.size_512_512
format: op.ImageRespType.url
size: op.ImageSize.size_512_512
format: op.ImageRespType.url
})!
print(images_updated)
images_variatons := ai_cli.create_variation_image(op.ImageVariationArgs{
image_path: '/path/to/image.png'
num_images: 2
size: op.ImageSize.size_512_512
format: op.ImageRespType.url
size: op.ImageSize.size_512_512
format: op.ImageRespType.url
})!
print(images_variatons)