aboutsummaryrefslogtreecommitdiff
path: root/statement.go
AgeCommit message (Collapse)Author
2025-12-27all: update all dependencies and fix linter warningsShulhan
In the internal/, fix the "reuse lint" warnings due to embedded SPDX headers string that contains "\n" considered as invalid. Realign struct Statement based on fieldaligment check.
2025-10-03all: add option "$noparse" for magic "#put" commandShulhan
The "$noparse" option allow copying file without reading and parsing the input file.
2024-03-22all: replace module "share" with "pakakeh.go"Shulhan
The "share" project has been moved to SourceHut with new name "pakakeh.go".
2023-10-22all: add magic command "#local"Shulhan
The magic command "#local" define the command to be executed using shell in local environment. Its have effect and can only be used in script that executed using "play". In script that is executed using "local" it does nothing.
2023-10-22all: rewrite method String in StatementShulhan
Instead of returning the string based on cmd and args values, return it based on its kind. In this way, the full line of magic command is returned before as is.
2023-10-20all: add parser for magic command "#get" or "#put" with owner and modeShulhan
The owner and mode is defined after the magic command with the following syntax, [ USER [ ":" GROUP ]] ["+" MODE] The USER and/or GROUP is optional, its accept the value as in "chown". The MODE also optional, its value must be an octal.
2023-10-12all: fix printing the statement to be executedShulhan
This fix missing magic command not printed in stdout.
2023-10-07all: simplify parsing statement for magic command "#get" and "#put"Shulhan
Since magic command get and put both use the same function, we can use loop to check and parse all of the get and put statement variants.
2023-10-07all: simplify parsing statement for magic command "#put"Shulhan
This changes minimize code duplication when parsing magic command between "#put:" and "#put!" using single function parseStatementGetPut. In the returned Statement, we changes where to store the source argument into args[0] instead of in cmd for better readability and minimize confusion in Copy/SudoCopy.
2023-10-06all: simplify parsing statement for magic command getShulhan
This changes minimize code duplication when parsing magic command between "#get:" and "#get!" using single function parseStatementGetPut. In the returned Statement, we changes where to store the source argument into args[0] instead of in cmd for better readability and minimize confusion in Copy/SudoCopy. While at it, we add unit test for "#get:". Unit test for "#get!" is not possible right now, because it will prompt for password.
2023-03-17all: fix and add comments to global constants and methodsShulhan
This mark the development for the next minor version.
2022-08-01all: clean up codesShulhan
Replace ":=" with explicit variable declaration with types for clarity and minimizing duplicate variables.
2022-07-31all: realign some structs to minimize memory usageShulhan
* Request: from 128 to 96 bytes (-32 bytes) * Session: from 176 to 160 bytes (-16 bytes) * Statement: from 56 to 48 bytes (-8 bytes) * session_test.go:24:13: struct with 48 pointer bytes could be 40 * statement_test.go:13:13: struct with 32 pointer bytes could be 16
2022-06-20all: reformat all go files using the next gofmtShulhan
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.