1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

CliAutocomplete for diff #1630 (#1677)

CliAutocomplete for diff #1630
This commit is contained in:
Michael Keller 2019-10-29 19:53:33 +13:00 committed by GitHub
commit 4d7cc704b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
})
]);
};