Bagotia16/CHASS
Code hide and seek surveillance
CHASS
Code Hide And Seek Surveillance
A user friendly CLI debugging tool exclusively for bash scripts.
Table of Content
Installation
If you don't have virtualenv installed
sudo pip3 install virtualenvNow make a virtual env inside the repo
python3 -m venv chassenvActivate the virtual env
source chassenv/bin/activateNow install the chass package
python3 -m pip install .Usage
For all options available
chass --helpFile path is the argument that must be provided.
Default mode():
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}Variable mode():
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)}Variable at given line mode():
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}Code at a given line mode():
Get code at a specified line
chass {path-to-file} --code {line-number}or
chass {path-to-file} -c {line-number}Get Particular segment of your code :
Get a particular section of code present between two line numbers
chass {path-to-file} --codeline {start-line-number} {end-line-number}Debug only a particular section of your code :
Debugs only the section present between two line numbers
chass {path-to-file} --breakpoints {start-line-number} {end-line-number}function mode() :
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}printall mode() :
Prints all the changed variables' values at every line in one go
chass {path-to-file} --printallor
chass {path-to-file} -pprintall values of given multiple variables mode() :
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)}loops mode():
Debug only loops iteration wise
chass {path-to-file} --loopsor
chass {path-to-file} -rconditions mode():
Debug only conditions line by line
chass {path-to-file} --condor
chass {path-to-file} -iDebugging only sed commands mode():
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)get actual output :
Shows the actual output of the file
chass {path-to-file} --outputor
chass {path-to-file} -oEXPRESSION MODE ():
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)
exprStep 2 :
write the expression in bash syntax
{expression_to_be_calculated_in_valid_bash_syntax}PWD mode():
At any line inside default mode() you can print working directory (Note: line should not be in any loop,if and case)
pwdGet code of any particular line in Default mode():
At any line inside default mode you can get the line written by you in the original code by just typing "c"
cQuit():
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
quitLimitations
- 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
Contributing
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.