Code Hide And Seek Surveillance
A user friendly CLI debugging tool exclusively for bash scripts.
If you don't have virtualenv installed
sudo pip3 install virtualenv
Now make a virtual env inside the repo
python3 -m venv chassenv
Activate the virtual env
source chassenv/bin/activate
Now install the chass package
python3 -m pip install .
For all options available
chass --help
File path is the argument that must be provided.
Get the value of changed variables lines by line (functions are to be dealt with separately using function mode given below)
chass {path-to-file}
Get the value of specific multiple variables line by line
chass {path-to-file} --variable={variable-name_1} --variable={variable-name_3_(optional)}
or
chass {path-to-file} -v {variable-name_1} -v {variable-name_2_(optional)}
Get the value of a specific variable at a specific line
chass {path-to-file} --variable={variable-name} --line={line-number}
or
chass {path-to-file} -v {variable-name} -l {line-number}
Get code at a specified line
chass {path-to-file} --code {line-number}
or
chass {path-to-file} -c {line-number}
Get a particular section of code present between two line numbers
chass {path-to-file} --codeline {start-line-number} {end-line-number}
Debugs only the section present between two line numbers
chass {path-to-file} --breakpoints {start-line-number} {end-line-number}
Debug a function by providing the name of the function
chass {path-to-file} -f {function_name}
or
chass {path-to-file} --function {function_name}
Prints all the changed variables' values at every line in one go
chass {path-to-file} --printall
or
chass {path-to-file} -p
Prints values of the given multiple variables at each line in one go
chass {path-to-file} --printall --variable={variable_name_1} --variable={variable_name_2(optional)}
or
chass {path-to-file} -p -v {variable_name_1} -v {variable_name_2(optional)}
Debug only loops iteration wise
chass {path-to-file} --loops
or
chass {path-to-file} -r
Debug only conditions line by line
chass {path-to-file} --cond
or
chass {path-to-file} -i
Debug only sed commands. You can specify line_number also to debug a specific sed command
chass {path-to-file} --sed -l {line_number}(optional)
or
chass {path-to-file} -s -l {line_number}(optional)
Shows the actual output of the file
chass {path-to-file} --output
or
chass {path-to-file} -o
At any given line you can write valid syntax bash expression involving any of defined variables. We will give value of that expression by using values of variables upto that line
Step 1 : write expr in the default mode() at any line (Note: line should not be in any loop,if and case)
expr
Step 2 : write the expression in bash syntax
{expression_to_be_calculated_in_valid_bash_syntax}
At any line inside default mode() you can print working directory (Note: line should not be in any loop,if and case)
pwd
At any line inside default mode you can get the line written by you in the original code by just typing "c"
c
You can exit the process at any stage by typing quit. If you are inside any loop, a single quit will get you out of the loop and typing quit again will terminate chass
quit
- Absolute File paths should be given everywhere inside the code
- Avoid using recursive functions for best usage
- Any String should not contain " sed ", " cd " and other keywords as a part of it
- Syntax of the file is assumed to be correct
- rm command should not be present inside file
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.