mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-12-15 17:11:20 +01:00
improved autocomplete for getbit,setbit, clearbit
This commit is contained in:
@@ -323,10 +323,32 @@ return 0
|
||||
}
|
||||
__clearbit() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "4" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__clearbusy() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 1 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "4" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__clientversion() {
|
||||
@@ -1160,6 +1182,22 @@ return 0
|
||||
}
|
||||
__getbit() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 1 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
fi
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__hardwareversion() {
|
||||
@@ -2354,6 +2392,17 @@ return 0
|
||||
}
|
||||
__setbit() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "4" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__settings() {
|
||||
|
||||
@@ -247,10 +247,32 @@ return 0
|
||||
}
|
||||
__clearbit() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "4" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__clearbusy() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 1 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "4" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__clientversion() {
|
||||
@@ -1084,6 +1106,22 @@ return 0
|
||||
}
|
||||
__getbit() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 1 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
fi
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__hardwareversion() {
|
||||
@@ -2278,6 +2316,17 @@ return 0
|
||||
}
|
||||
__setbit() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "3" ]]; then
|
||||
FCN_RETURN=""
|
||||
fi
|
||||
if [[ "${cword}" == "4" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__settings() {
|
||||
|
||||
@@ -2799,20 +2799,30 @@ getbit:
|
||||
is_description: true
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
argc: 2
|
||||
arg_types: [ std::string, std::string ]
|
||||
|
||||
|
||||
setbit:
|
||||
is_description: true
|
||||
actions:
|
||||
PUT:
|
||||
argc: -1
|
||||
args:
|
||||
- argc: 2
|
||||
arg_types: [ std::string, std::string ]
|
||||
- argc: 3
|
||||
arg_types: [ std::string, std::string, bool ]
|
||||
|
||||
clearbit:
|
||||
is_description: true
|
||||
actions:
|
||||
PUT:
|
||||
argc: -1
|
||||
args:
|
||||
- argc: 2
|
||||
arg_types: [ std::string, std::string ]
|
||||
- argc: 3
|
||||
arg_types: [ std::string, std::string, bool ]
|
||||
|
||||
|
||||
################# special commands ##########################
|
||||
|
||||
|
||||
@@ -1095,8 +1095,24 @@ clearbit:
|
||||
actions:
|
||||
PUT:
|
||||
args:
|
||||
- arg_types: []
|
||||
argc: -1
|
||||
- arg_types:
|
||||
- std::string
|
||||
- std::string
|
||||
argc: 2
|
||||
cast_input: []
|
||||
check_det_id: false
|
||||
convert_det_id: true
|
||||
function: ''
|
||||
input: []
|
||||
input_types: []
|
||||
output: []
|
||||
require_det_id: false
|
||||
store_result_in_t: false
|
||||
- arg_types:
|
||||
- std::string
|
||||
- std::string
|
||||
- bool
|
||||
argc: 3
|
||||
cast_input: []
|
||||
check_det_id: false
|
||||
convert_det_id: true
|
||||
@@ -4724,8 +4740,10 @@ getbit:
|
||||
actions:
|
||||
GET:
|
||||
args:
|
||||
- arg_types: []
|
||||
argc: -1
|
||||
- arg_types:
|
||||
- std::string
|
||||
- std::string
|
||||
argc: 2
|
||||
cast_input: []
|
||||
check_det_id: false
|
||||
convert_det_id: true
|
||||
@@ -9546,8 +9564,24 @@ setbit:
|
||||
actions:
|
||||
PUT:
|
||||
args:
|
||||
- arg_types: []
|
||||
argc: -1
|
||||
- arg_types:
|
||||
- std::string
|
||||
- std::string
|
||||
argc: 2
|
||||
cast_input: []
|
||||
check_det_id: false
|
||||
convert_det_id: true
|
||||
function: ''
|
||||
input: []
|
||||
input_types: []
|
||||
output: []
|
||||
require_det_id: false
|
||||
store_result_in_t: false
|
||||
- arg_types:
|
||||
- std::string
|
||||
- std::string
|
||||
- bool
|
||||
argc: 3
|
||||
cast_input: []
|
||||
check_det_id: false
|
||||
convert_det_id: true
|
||||
|
||||
@@ -400,8 +400,18 @@ int InferAction::chipversion() {
|
||||
|
||||
int InferAction::clearbit() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: clearbit. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
if (args.size() == 2) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
if (args.size() == 3) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::clearbusy() {
|
||||
@@ -1510,8 +1520,14 @@ int InferAction::gates() {
|
||||
|
||||
int InferAction::getbit() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: getbit. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
if (args.size() == 2) {
|
||||
return slsDetectorDefs::GET_ACTION;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::hardwareversion() {
|
||||
@@ -3061,8 +3077,18 @@ int InferAction::serialnumber() {
|
||||
|
||||
int InferAction::setbit() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: setbit. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
if (args.size() == 2) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
if (args.size() == 3) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::settings() {
|
||||
|
||||
Reference in New Issue
Block a user