mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
CliAutocomplete for diff
#1630
This commit is contained in:
parent
0648e5d927
commit
e6b2201de1
1 changed files with 39 additions and 0 deletions
|
@ -521,4 +521,43 @@ CliAutoComplete._initTextcomplete = function() {
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// diff command
|
||||||
|
var diffArgs1 = ["master", "profile", "rates", "all"];
|
||||||
|
var diffArgs2 = [];
|
||||||
|
|
||||||
|
if (semver.lt(CONFIG.flightControllerVersion, "3.4.0")) {
|
||||||
|
diffArgs2.push("showdefaults");
|
||||||
|
} else {
|
||||||
|
// above 3.4.0
|
||||||
|
diffArgs2.push("defaults");
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "4.0.0")) {
|
||||||
|
diffArgs1.push("hardware");
|
||||||
|
diffArgs2.push("bare");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diffArgs1.sort();
|
||||||
|
diffArgs2.sort();
|
||||||
|
|
||||||
|
$textarea.textcomplete('register', [
|
||||||
|
strategy({ // "diff arg1"
|
||||||
|
match: /^(\s*diff\s+)(\w*)$/i,
|
||||||
|
search: function(term, callback, match) {
|
||||||
|
sendOnEnter = true;
|
||||||
|
searcher(term, callback, diffArgs1, 1, true);
|
||||||
|
},
|
||||||
|
template: highlighterPrefix
|
||||||
|
}),
|
||||||
|
|
||||||
|
strategy({ // "diff arg1 arg2"
|
||||||
|
match: /^(\s*diff\s+\w+\s+)(\w*)$/i,
|
||||||
|
search: function(term, callback, match) {
|
||||||
|
sendOnEnter = true;
|
||||||
|
searcher(term, callback, diffArgs2, 1, true);
|
||||||
|
},
|
||||||
|
template: highlighterPrefix
|
||||||
|
})
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue