vladimir-kotikov / clink-completions Goto Github PK
View Code? Open in Web Editor NEWCompletion files to clink util
License: MIT License
Completion files to clink util
License: MIT License
Unlike NPM, yarn run
can run local modules in addition to project.json
scripts.
I managed to do that locally with the following simple changes:
local bins = matchers.create_files_matcher('node_modules/.bin/*.')
-- ... skip some parser code
"run"..parser({bins, scripts}),
And this works, with 2 limitations that I am not sure how to fix:
color_text
the results but it didn't work.create_files_matcher
returns .
and ..
. create_dirs_matcher
has some code to avoid that, it should probably be added to create_files_matcher
as well.Hey, I am the guy behind Cmder. I was considering to include your amazing project. Would that be okay? I of course would include proper attribution.
Thanks
In this WIP
I found that clink divides autocompletion on "/".
$ git rebase <TAB>
origin/master origin/wip vladimir/master vladimir/extended vladimir/dev master wip
$ git rebase o<TAB>
$ git rebase origin/<TAB>
-- no output --
and it do not offer autocompletion
When there is only one branch on remote autocompletion works.
Is there any solution to avoid stop on "/"? I've tried "disable_file_matching()" but didn't solve it.
Recently Chocolatey is moving to different naming strategy when it comes to packages.
If I'm having a git.install
package installed, clink completions shows only git
as a suggestion.
I guess the regex should be:
local package_name = dir:match("^(%w%.*)%.")
Need to parse .git/config
file to get actual information about remotes instead of ls
ing .git/remotes
Hello,
I would like to request autocomple for npm install
(suggesting packages) like it does from npm remove
.
Thank you!
At file line npm.lua#214 seems that makes the output appear twice, I do not knwo if this is the intended behaviour
C:\dev\github\app (rc-1.2.1) ([email protected]) ([email protected])
Note how the proje ([email protected])
shows twice.
npm run
autocompletion doesn't display scripts after script that contains {
and }
.
My scripts block:
"scripts": {
"grunt": "grunt",
"build": "grunt styles",
"cordova": "cordova",
"ionic": "ionic",
"jspm": "jspm",
"bundle": "jspm bundle app/desktop/main.js - text www/dist/app.js --no-mangle --skip-source-maps --inject",
"nwb": "nwb",
"prepare:nwjs": "grunt styles",
"bundle-sfx:nwjs": "jspm bundle-sfx app/nwjs/main platforms/nwjs/platform_www/sfx.js --no-mangle --skip-source-maps",
"nwbuild": "nwb nwbuild -o platforms/nwjs/build platforms/nwjs/platform_www/ -i \"./www:{app/**,jspm_packages/github/driftyco/ionic*/fonts/*.woff,jspm_packages/npm/font-awesome*/fonts/*.woff}\" --win-ico ./resources/nwjs/icon.ico --mac-icns ./resources/nwjs/icon.icns",
"nwbuild:prod": "npm run nwbuild -- -v 0.15.0",
"nwbuild:dev": "npm run nwbuild -- -v 0.15.0-sdk",
"build:nwjs:prod": "npm run prepare:nwjs && npm run bundle-sfx:nwjs && npm run nwbuild:prod",
"build:nwjs:dev": "npm run prepare:nwjs && npm run bundle-sfx:nwjs && npm run nwbuild:dev",
"run:nwjs:dev": "nwb nwbuild ./www -v 0.15.0-sdk -r"
},
Autocompletion output:
C:\dev\ft\development>npm run
build bundle-sfx:nwjs grunt jspm prepare:nwjs
bundle cordova ionic nwb
Autocompletion after I remove {
and }
from nwbuild
:
C:\dev\ft\development>npm run
build bundle grunt nwb nwbuild:prod
build:nwjs:dev bundle-sfx:nwjs ionic nwbuild prepare:nwjs
build:nwjs:prod cordova jspm nwbuild:dev run:nwjs:dev
D:\Cmder/vendor/clink-completions/npm.lua:45: attempt to index local 'package_json' (a nil value)
Following #74, I tested formatted completions: /.bin
executables are displayed plain, package.json
scripts are prefixed with a *
.
The result is better than nothing, although color would be 10x better ๐ญ
To achieve this, I modified the scripts
function as follows:
local function scripts_display_filter(scripts)
return function(matches)
for i, m in ipairs(matches) do
local prefix = scripts[m] ~= nil and '* ' or ' '
matches[i] = prefix..m
end
return matches
end
end
-- Reads package.json in current directory and extracts all "script" commands defined
local function scripts(token)
-- Read package.json first
local package_json = io.open('package.json')
-- If there is no such file, then close handle and return
if package_json == nil then return {} end
-- Read the whole file contents
local package_contents = package_json:read("*a")
package_json:close()
local scripts = w(JSON:decode(package_contents).scripts)
clink.match_display_filter = scripts_display_filter(scripts)
return scripts:keys()
end
Docker client is popular tool that now available on Windows:
https://docs.docker.com/windows/step_one/
It comes with bash completion file:
https://github.com/docker/docker/blob/master/contrib/completion/bash/docker
Git completions seem to rely on finding the git-dir as per
Lines 14 to 30 in e2467f6
However, since Git 1.7.8, submodules don't contain a .git/ folder anymore.
Instead, the submodule directory is populated with a .git text file
which contains a git-dir: /path/to/superproject/git_dir/modules/name.
See: https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.8.txt#L109-L114
It believe that changing the implementation of get_git_dir()
to make it parse the git-dir
value from the .git
text file will solve the issue. I would have offered a PR right now if I was more familiar with the Lua syntax :)
From cmderdev/cmder#174 (comment)
See https://git-scm.com/docs/git-push for details on refspec syntax
See mridgers/clink#358 (comment)
git subcommands aren't expanding for me
with this: https://www.dropbox.com/sh/hqbrpkf0dpmmizq/gGX4XWAWIA
Is anyone using a git prompt, something that shows current branch etc? If so, can you share it so I can copy/modify :)
after invoking npm run start{TAB}
using be93929
When you define something like
$ git config alias.ci commit
you can issue
$ git ci -m "whatever"
To do a commit
Is expected that you can autocomplete on this shorcuts
Technical doc:
Currently these parameters queried on each module load, which adds delay to each console startup time. Hovewer these values are only required when completing some npm
commands / processing prompt when inside package.
Need to make these values lazy-loaded only when really required.
Git completions for number of commands that using branches
and remotes
functions produces an set of completions with a pair of .
and ..
added. Looks like tha problem is that clink.find_dirs
now returns these metadirectories in result as well.
nvm!
There is a bunch or rebase-*
commnds for git and basically arguments for them should be almost the same so this gonna be easy. List of commands:
rebase--am
rebase--interactive
rebase--merge
Current completions set is not fully compatible with Cmder. Specifically there is a lack of prompt handling and replacing of {git}
and {lamb}
sequences in prompt.
Also there is an additional template for hg
seems to be appeared in cmderdev/cmder@af30a90 and this could be added as well.
I am trying to use your most recent version of git.lua with the latest clink (0.4.2). I keep getting following error -
Clink v0.4.2 [git:1111eb] Copyright (c) 2014 Martin Ridgers
http://mridgers.github.io/clink
D:\Apps\cmder\vendor\clink-new/clink.lua:897: Tables can't have meta-tables.
I see that clink is updated as per your suggestions for config file. I also verified that the error is displayed only when I use newer version of git.lua. I have an old version from cmder and it doesn't yield error but is way too limited. Thanks a ton for investing your time in writing these useful scripts. I would request you to distribute most recent compatible version of clink too along with your extensions to avoid compatibility issues.
Tilde in windows console isn't supported, and its surrogates, like environnment variable %~%, are ugly.
Is there guidance on how you install these completions?
For examples, right now I'm copying from this git directory into %localappdata%. Is there a better way?
We have branches in the following format:
feature/f-1#blablabla
feature/f-2#blablabla
when I type "git checkout" and press tab, I only see "*feature"
hub is a command-line wrapper for git that makes you better at GitHub. See https://hub.github.com for CLI examples
modules
directory)If there's a remote branch origin/foo
but no local branch foo
, then git checkout foo
automatically sets up a new local branch foo
that tracks origin/foo
. Currently, the completion foo
is not picked up because the name of the existing branch is origin/foo
, not foo
. I would be nice to get completion for the foo
in such situations.
I installed cmdr
which hapens to use your clink-completions. I stumbled upon this error, where we get the following message when a console starts.
.../vendor/clink-completions/vagrant.lua:66: Additional arguments to new_parser() must be tables or strings
This issue has been reported on cmdr issue #779, but no real fix has been found.
Currently I have commented out line 66 to have the message go away, but I'm missing the intended functionality.
I have tryed to troublesoot the issue, but was not able to figure it out. So, I just want to report the issue so you are ware of it.
Thanks.
Running git gc
causes following error:
Rename from '<some_path>/.git/packed-refs.lock' to '<some_path>/.git/packed-refs' failed. Should I try again? (y/n)
Yarn is a new alternative to npm
. https://github.com/yarnpkg/yarn
A set of completions in this repo depends on chosen branch. Hovewer this solution is far from ideal but i have some reasons for it. Probably this should be documented better than now.
Running against master
if you enter git diff -
and hit tab
you will get the following error: clink-completions/modules/tables.lua:51: stack overflow
I haven't checked but this looks like a typo to me https://github.com/vladimir-kotikov/clink-completions/blob/master/git.lua#L825 a few lines down again, too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.