aboutsummaryrefslogtreecommitdiff
path: root/script.go
AgeCommit message (Collapse)Author
2023-11-11script: respect spaces when joining multi lines commandShulhan
If a multi lines command does not have spaces or have multiple spaces, join them as is. For example, a\ b should return the value as "ab", while a \ b should return "a b".
2023-10-29all: remove global variable newLineShulhan
2023-09-27all: make .Vars, .Val, and .Vals panic if values is emptyShulhan
This is to prevent copying or executing command with value that are not defined or typo which make the result empty and may result in undefined behaviour. For example if we have "app_dir = /data/app" and command in the script that remove that directory recursively, sudo rm -r {{.Val "::app_dir}}/bin will result removing "/bin" entirely.
2023-09-23all: merge some functions into NewScript and ParseScriptShulhan
Previously, we have NewScriptForLocal, NewScriptForRemote, ParseScriptForLocal, and ParseScriptForRemote. Since script for local and remote actually the same and since we remove applying environment variables at 858c26d3d940 on local, we can merge them into NewScript and ParseScript.
2023-09-06all: remove unused parameter isLocal on parseScriptShulhan
2023-09-04all: do not expand environment during parseScriptShulhan
Environment variables in the script may only expanded by shell on remote not always on local.
2022-08-01all: clean up codesShulhan
Replace ":=" with explicit variable declaration with types for clarity and minimizing duplicate variables.
2022-06-20all: reformat all go files using the next gofmtShulhan
2022-04-03all: replace ioutil.ReadFile with os.ReadFileShulhan
The ioutil.ReadFile has been deprecated since 1.16.
2022-03-14all: change the awwan software license to GPL 3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl for more information.
2021-08-22all: refactoring to support custom standard output and errorShulhan
Previously, all of the local and remote command execution will be redirected to operating system standard output and error. This commit refactoring the code to allow Local or Play command to use custom standard output and error per request.
2021-08-22all: rewrite the Session and Script using StatementShulhan
The idea for rewrite is to separate between local and remote script, so we can apply environment variables to local script. We also parse and validate each statements before being executed to simplify the code.
2021-08-11all: join the require statement into single lineShulhan
Previously the statement for #require: must be declared on the next line. This changes deprecated the statement to be declared on the next line, instead it must be on the same line as require itself.
2021-08-09all: rewrite the join statements function on ScriptShulhan
Some enhancements and fixes, * Trim the spaces on each statement before checking for continued line * Trim the spaces on continued line * Set the empty lines to nil, to minimize memory usage
2021-08-09all: refactoring the codeShulhan
Previously we have Command, environment, and script types to handle all functionalities. The name for Command is kind a misleading, because it contains method to copy files in local or remote and to execute script in local or remote. This refactoring break down the types into Awwan, Session, and Script. Awwan contains cache of sessions and cache of environment files. Session manage and cache SSH client and list of scripts. One session have one SSH client, but may contains more than one script. Script define the content of ".aww" file, line by line.
2021-04-12all: check and return an error if start index is out of rangeShulhan
2021-03-09all: unexport the environment typeShulhan
This type is not usable if its exported. So, let unexport them to let user focus on Command.
2021-03-08all: move script path, start, and end from Environment to CommandShulhan
This is the second commit for refactoring the code. The Environment will responsible to load the awwan.env files and SSHConfig, everything else will be handled by Command.
2021-03-07all: never, ever use log.Fatal on libraryShulhan
A good library is the one that return an error when something happened, not immediately stop the program. I made a mistake and I learn from it.
2020-06-04all: add magic command "#require:"Shulhan
Magic word `#require:` will ensure that the next statement will always executed when its skipped with start number. For example, given following script with line number 1: #require: 2: echo a 3: echo b 4: #require: 5: echo c ``` executing `awwan local script.aww 3`, will always execute line number 2 `echo a`, but not line number 5 (because its before line start 3).
2020-06-04command: merge sequences of spaces on command into single spaceShulhan
2020-04-15all: refactoring the environmentShulhan
This change remove the command mode "bootstrap" and replace default environment file from "env.ini" to "awwan.env".
2019-10-26awwan: the configuration management for local and cloudShulhan
awwan is command line interface to configurate and manage remote system through SSH connection.