Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(std): more commands #185

Merged
merged 23 commits into from
Jul 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed functions
Mte90 authored Jun 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 50fbb4eb590019989ce581fc8e2bad2a481b861f
26 changes: 2 additions & 24 deletions src/std/main.ab
Original file line number Diff line number Diff line change
@@ -129,19 +129,7 @@ pub fun includes(arr, value) {
return false
}

pub fun move(origin: Text, destination: Text): Null {
unsafe $mv "{origin}" "{destination}"$
}

pub fun change_dir(path: Text): Null {
if dir_exist(origin) {
unsafe $cd "{path}" || exit$
}

return false
}

pub fun make_symbolic_link(origin: Text, destination: Text): Null {
pub fun create_symbolic_link(origin: Text, destination: Text): Bool {
if file_exist(origin) {
unsafe $ln -s "{origin}" "{path}"$
return true
@@ -157,7 +145,7 @@ pub fun create_dir(path: Text): Null {
}
}

pub fun make_executable(path: Text): Null {
pub fun make_executable(path: Text): Bool {
if file_exist(origin) {
unsafe $chmod +x "{path}"$
return true
@@ -171,13 +159,3 @@ pub fun switch_user_permission(user: Text, path: Text): Null {
// TODO when OR will be available we need to check if the folder or file exist
unsafe $chown -R "{user}" "{path}"$
}

pub fun delete(path: Text): Null {
if not includes(['/', '.', '..'], path) {
unsafe $rm -fr "{path}"$
return true
}

echo "The file {$path} can't be deleted!"
return false
}