diff options
| author | Shulhan <ms@kilabit.info> | 2023-10-06 01:33:12 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-10-06 01:33:12 +0700 |
| commit | b22f2104dd822a890b8f8b8de5489215493c0812 (patch) | |
| tree | 08b4c281c95ff7f8693cddc3dce2ce25c46c57cf /awwan.go | |
| parent | 006fe79d7523c47102462595d8e8664fc1910c6a (diff) | |
| download | awwan-b22f2104dd822a890b8f8b8de5489215493c0812.tar.xz | |
all: simplify parsing statement for magic command get
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.
Diffstat (limited to 'awwan.go')
| -rw-r--r-- | awwan.go | 9 |
1 files changed, 1 insertions, 8 deletions
@@ -41,14 +41,7 @@ const defEncryptExt = `.vault` // defFileEnvVault default awwan environment file name that is encrypted. const defFileEnvVault = `.awwan.env.vault` -var ( - cmdMagicGet = []byte("#get:") - cmdMagicPut = []byte("#put:") - cmdMagicSudoGet = []byte("#get!") - cmdMagicSudoPut = []byte("#put!") - cmdMagicRequire = []byte("#require:") - newLine = []byte("\n") -) +var newLine = []byte("\n") // Awwan is the service that run script in local or remote. // Awwan contains cache of sessions and cache of environment files. |
