Compare commits
4 Commits
master
...
Integratio
| Author | SHA1 | Date |
|---|---|---|
|
|
f5ebe28925 | |
|
|
544ea70569 | |
|
|
ce8adb30e0 | |
|
|
af9fd3b64b |
|
|
@ -816,8 +816,8 @@ nohelpers\t'exclude helper commands'
|
|||
config\t'list completion.commands'"
|
||||
|
||||
# Options shared between multiple commands
|
||||
set -l format_pretty_args "oneline\t'hash⏎ titleline' short\t'hash⏎ author⏎ titleline' medium\t'hash⏎ author⏎ authordate⏎ title⏎ message' full\t'hash⏎ author⏎ committer⏎ title⏎ message'
|
||||
fuller\t'hash⏎ author⏎ authordate⏎ committer⏎ committerdate⏎ title⏎ message' email\t'hash⏎ date⏎ author⏎ authordate⏎ title⏎ message' raw\t'Show raw commit as stored in commit object' format:\t'Specify format string'"
|
||||
set -l format_pretty_args "oneline\t'hash titleline' short\t'hash author titleline' medium\t'hash author authordate title message' full\t'hash author committer title message'
|
||||
fuller\t'hash author authordate committer committerdate title message' email\t'hash date author authordate title message' raw\t'Show raw commit as stored in commit object' format:\t'Specify format string'"
|
||||
complete -f -c git -n '__fish_git_using_command log show diff-tree rev-list' -l pretty -a $format_pretty_args
|
||||
|
||||
complete -c git -n '__fish_git_using_command diff show range-diff' -l abbrev -d 'Show only a partial prefix instead of the full 40-byte hexadecimal object name'
|
||||
|
|
@ -2226,15 +2226,13 @@ end
|
|||
|
||||
# source git-* commands' autocompletion file if exists
|
||||
set -f __fish_git_custom_commands_completion
|
||||
for file in $PATHgitdash
|
||||
test ! -x $file
|
||||
and continue
|
||||
|
||||
set -l subcommand (path basename $file)
|
||||
for file in (path filter -xZ -- $PATHgitdash | path basename)
|
||||
# Already seen this command earlier in $PATH.
|
||||
contains -- $subcommand $__fish_git_custom_commands_completion
|
||||
contains -- $file $__fish_git_custom_commands_completion
|
||||
and continue
|
||||
|
||||
complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
|
||||
# Running `git foo` ends up running `git-foo`, so we need to ignore the `git-` here.
|
||||
set -l cmd (string replace -r '^git-' '' -- $file)
|
||||
complete -c git -f -n "__fish_git_using_command $cmd" -a "(__fish_git_complete_custom_command $cmd)"
|
||||
set -a __fish_git_custom_commands_completion $subcommand
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Note that when a completion file is sourced a new block scope is created so `set -l` works.
|
||||
set -l __fish_status_all_commands current-command current-filename current-function current-line-number features filename fish-path function is-block is-breakpoint is-command-substitution is-full-job-control is-interactive is-interactive-job-control is-login is-no-job-control job-control line-number print-stack-trace stack-trace test-feature
|
||||
set -l __fish_status_all_commands current-command current-commandline current-filename current-function current-line-number features filename fish-path function is-block is-breakpoint is-command-substitution is-full-job-control is-interactive is-interactive-job-control is-login is-no-job-control job-control line-number print-stack-trace stack-trace test-feature
|
||||
|
||||
# These are the recognized flags.
|
||||
complete -c status -s h -l help -d "Display help and exit"
|
||||
|
|
@ -16,6 +16,7 @@ complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_com
|
|||
|
||||
# The subcommands that are not "is-something" which don't change the fish state.
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a current-command -d "Print the name of the currently running command or function"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a current-commandline -d "Print the currently running command with its arguments"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a current-filename -d "Print the filename of the currently running script"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a filename -d "Print the filename of the currently running script"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a current-function -d "Print the name of the current function"
|
||||
|
|
|
|||
|
|
@ -293,19 +293,6 @@ body {
|
|||
border-bottom: #444 dotted 1px;
|
||||
}
|
||||
|
||||
.abbreviation_actions {
|
||||
width: 8em;
|
||||
text-align: right;
|
||||
border-bottom: #444 dotted 1px;
|
||||
}
|
||||
|
||||
.abbreviation_input {
|
||||
height: 1.5em;
|
||||
font: inherit;
|
||||
padding: 3px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* The CSS we apply when a table row is filtered */
|
||||
.data_table_row_filtered {
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
<div ng-class="{'tab': true, 'selected_tab': currentTab == 'variables'}" id="tab_variables" ng-click="changeView('variables')">variables</div>
|
||||
<div ng-class="{'tab': true, 'selected_tab': currentTab == 'history'}" id="tab_history" ng-click="changeView('history')">history</div>
|
||||
<div ng-class="{'tab': true, 'selected_tab': currentTab == 'bindings'}" id="tab_bindings" ng-click="changeView('bindings')">bindings</div>
|
||||
<div ng-class="{'tab': true, 'selected_tab': currentTab == 'abbreviations'}" id="tab_abbreviations" ng-click="changeView('abbreviations')">abbreviations</div>
|
||||
</div>
|
||||
<div id="tab_contents">
|
||||
<ng-view></ng-view>
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@ fishconfig.config(
|
|||
controller: "bindingsController",
|
||||
templateUrl: "partials/bindings.html"
|
||||
})
|
||||
.when("/abbreviations", {
|
||||
controller: "abbreviationsController",
|
||||
templateUrl: "partials/abbreviations.html"
|
||||
})
|
||||
.otherwise({
|
||||
redirectTo: "/colors"
|
||||
})
|
||||
|
|
|
|||
|
|
@ -395,49 +395,3 @@ controllers.controller("bindingsController", function($scope, $http) {
|
|||
|
||||
$scope.fetchBindings();
|
||||
});
|
||||
|
||||
controllers.controller("abbreviationsController", function($scope, $http) {
|
||||
$scope.abbreviations = [];
|
||||
$scope.addBlank = function() {
|
||||
// Add blank entry if it is missing
|
||||
var hasBlank = {hasBlank: false}
|
||||
angular.forEach($scope.abbreviations, function(value, key) {
|
||||
if (value.phrase === "" && value.word === "") {
|
||||
this.hasBlank = true;
|
||||
}
|
||||
}, hasBlank);
|
||||
if (!$scope.abbreviations) $scope.abbreviations = [];
|
||||
if (! hasBlank.hasBlank) {
|
||||
$scope.abbreviations.push({phrase: "", word: "", editable: true})
|
||||
}
|
||||
}
|
||||
$scope.fetchAbbreviations = function() {
|
||||
$http.get("abbreviations/").then(function(arg) {
|
||||
$scope.abbreviations = arg.data;
|
||||
$scope.addBlank();
|
||||
})};
|
||||
|
||||
$scope.editAbbreviation = function(abbreviation) {
|
||||
abbreviation.editable = true;
|
||||
}
|
||||
|
||||
$scope.saveAbbreviation = function(abbreviation) {
|
||||
if (abbreviation.word && abbreviation.phrase) {
|
||||
$http.post("save_abbreviation/", abbreviation).then(function(arg) {
|
||||
abbreviation.editable = false;
|
||||
$scope.addBlank();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.removeAbbreviation = function(abbreviation) {
|
||||
if (abbreviation.word) {
|
||||
$http.post("remove_abbreviation/", abbreviation).then(function(arg) {
|
||||
$scope.abbreviations.splice($scope.abbreviations.indexOf(abbreviation), 1);
|
||||
$scope.addBlank();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.fetchAbbreviations();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -41,20 +41,3 @@ filters.filter("filterBinding", function() {
|
|||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
filters.filter("filterAbbreviations", function() {
|
||||
return function(abbreviations, query) {
|
||||
var result = []
|
||||
if (abbreviations == undefined) return result;
|
||||
if (query == null) { return abbreviations};
|
||||
|
||||
for(var i=0; i<abbreviations.length; ++i) {
|
||||
var abbr = abbreviations[i];
|
||||
if (abbr.word.toLowerCase().indexOf(query) != -1 || abbr.phrase.toLowerCase().indexOf(query.toLowerCase()) != -1) {
|
||||
result.push(abbr);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<div id="table_filter_container" style="display: block;">
|
||||
<input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query">
|
||||
</div>
|
||||
|
||||
<table class="data_table">
|
||||
<tbody>
|
||||
<tr class="data_table_row" ng-repeat="abbreviation in abbreviations | filterAbbreviations:query" ng-click="editAbbreviation(abbreviation)">
|
||||
<td ng-class="{ data_table_cell: true }" style="text-align: right; padding-right: 30px;">
|
||||
<span ng-hide="abbreviation.editable">{{ abbreviation.word }}</span>
|
||||
<span ng-show="abbreviation.editable"><input ng-model="abbreviation.word" class="abbreviation_input" style="text-align: right; min-width: 10em;"></span>
|
||||
</td>
|
||||
<td ng-class="{ data_table_cell: true }" style="text-align: left; padding-right: 30px;">
|
||||
<span ng-hide="abbreviation.editable">{{ abbreviation.phrase }}</span>
|
||||
<span ng-show="abbreviation.editable"><input ng-model="abbreviation.phrase" class="abbreviation_input" style="text-align: left; min-width: 22em;"></span>
|
||||
</td>
|
||||
<td ng-class="{ data_table_cell: true }" class="abbreviation_actions">
|
||||
<span ng-show="abbreviation.editable && abbreviation.word && abbreviation.phrase" ng-click="saveAbbreviation(abbreviation)"><button class="save_button" style="margin: inherit;">Save</button></span>
|
||||
<a ng-show="abbreviation.word" ng-click="removeAbbreviation(abbreviation)"><img alt="Delete" src="delete.png" style="vertical-align: text-bottom"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -1338,40 +1338,6 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||
result.extend([self.read_one_sample_prompt(path) for path in paths])
|
||||
return result
|
||||
|
||||
def do_get_abbreviations(self):
|
||||
# Example abbreviation line:
|
||||
# abbr -a -U -- ls 'ls -a'
|
||||
result = []
|
||||
out, err = run_fish_cmd("abbr --show")
|
||||
for line in out.rstrip().split("\n"):
|
||||
if not line:
|
||||
continue
|
||||
_, abbr = line.split(" -- ", 1)
|
||||
word, phrase = abbr.split(" ", 1)
|
||||
result.append({"word": word, "phrase": phrase})
|
||||
return result
|
||||
|
||||
def do_remove_abbreviation(self, abbreviation):
|
||||
out, err = run_fish_cmd("abbr --erase %s" % abbreviation["word"])
|
||||
if err:
|
||||
return err
|
||||
else:
|
||||
return None
|
||||
|
||||
def do_save_abbreviation(self, abbreviation):
|
||||
out, err = run_fish_cmd(
|
||||
# Remove one layer of single-quotes because escape_fish_cmd adds them back.
|
||||
"abbr --add %s %s"
|
||||
% (
|
||||
escape_fish_cmd(strip_one_layer(abbreviation["word"], "'")),
|
||||
escape_fish_cmd(strip_one_layer(abbreviation["phrase"], "'")),
|
||||
)
|
||||
)
|
||||
if err:
|
||||
return err
|
||||
else:
|
||||
return None
|
||||
|
||||
def secure_startswith(self, haystack, needle):
|
||||
if len(haystack) < len(needle):
|
||||
return False
|
||||
|
|
@ -1453,8 +1419,6 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||
output = self.do_get_color_for_variable(name)
|
||||
elif p == "/bindings/":
|
||||
output = self.do_get_bindings()
|
||||
elif p == "/abbreviations/":
|
||||
output = self.do_get_abbreviations()
|
||||
else:
|
||||
return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
|
||||
|
||||
|
|
@ -1577,18 +1541,6 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||
output = ["OK"]
|
||||
else:
|
||||
output = ["Unable to set prompt"]
|
||||
elif p == "/save_abbreviation/":
|
||||
errmsg = self.do_save_abbreviation(postvars)
|
||||
if errmsg:
|
||||
output = [errmsg]
|
||||
else:
|
||||
output = ["OK"]
|
||||
elif p == "/remove_abbreviation/":
|
||||
errmsg = self.do_remove_abbreviation(postvars)
|
||||
if errmsg:
|
||||
output = [errmsg]
|
||||
else:
|
||||
output = ["OK"]
|
||||
else:
|
||||
return self.send_error(404)
|
||||
|
||||
|
|
@ -1701,7 +1653,6 @@ if len(sys.argv) > 1:
|
|||
"variables",
|
||||
"history",
|
||||
"bindings",
|
||||
"abbreviations",
|
||||
]:
|
||||
if tab.startswith(sys.argv[1]):
|
||||
initial_tab = "#!/" + tab
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@ git init >/dev/null 2>&1
|
|||
# First set up a test alias - *before loading the completions*
|
||||
git config --local alias.re 'restore --staged'
|
||||
|
||||
# Test custom command completions by adding a command:
|
||||
|
||||
set -p PATH $PWD
|
||||
echo "echo foo" > git-frobnicate
|
||||
chmod +x git-frobnicate
|
||||
|
||||
complete -c git-frobnicate -xa 'foo bar baz'
|
||||
|
||||
complete -C'git frobnicate '
|
||||
#CHECK: bar
|
||||
#CHECK: baz
|
||||
#CHECK: foo
|
||||
|
||||
complete -C'git ' | grep '^add'\t
|
||||
# (note: actual tab character in the check here)
|
||||
#CHECK: add Add file contents to the staging area
|
||||
|
|
@ -41,9 +54,11 @@ touch foo
|
|||
|
||||
complete -C'git add '
|
||||
#CHECK: foo Untracked file
|
||||
#CHECK: git-frobnicate Untracked file
|
||||
|
||||
complete -C'git add :'
|
||||
#CHECK: :/:foo Untracked file
|
||||
#CHECK: :/:git-frobnicate Untracked file
|
||||
|
||||
git config alias.s status
|
||||
complete 'git s --s'
|
||||
|
|
@ -71,7 +86,7 @@ set -g __fish_git_prompt_show_informative_status 1
|
|||
set -g __fish_git_prompt_showuntrackedfiles 1
|
||||
fish_git_prompt
|
||||
echo
|
||||
#CHECK: (newbranch|…1)
|
||||
#CHECK: (newbranch|…2)
|
||||
set -e __fish_git_prompt_show_informative_status
|
||||
set -e __fish_git_prompt_showuntrackedfiles
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue