I would like to get autocomplete suggestions for a command line (e.g. git)
but through code in nodejs
so basically, I want to write code that given a command line, gets the autocomplete result.
for example: git b should output bisect blame branch bundle
so far I've tried using shelljs with the following:
shell.exec('git b\t\t', function(code, output){
console.log(output);
})
but I keep getting errors from git. 'b' is not a git command. See 'git --help'.
EDIT
currently I am using solution from:
Accessing bash completions for specific commands programmatically
but this solution is very specific to OS and command.
I am still interested in a library that will do it for me or some real easy solution.
how to get this done? is there a better way to resolve this?
Related
(not sure if I asked this earlier somewhere, but I can't find it)
Earlier I found out how to create a usable entry on the VSCode settings menu (also usable in settings.json) by editing these VSCode source files:
vscode/src/vs/editor/common/config/editorOptions.ts
Adding a variable in export interface IEditorOptions.
Adding an enum in export const enum EditorOption.
Adding an item in export const EditorOptions.
vscode/src/vs/editor/common/standalone/standaloneEnums.ts
Adding an enum to export enum EditorOption.
I don't know if that's the correct way, I just copied other options.
I hadn't yet figured out how to access the new entry's value from the function I wanted to use it in (I had already implemented the functionality, just without the option).
I then got sidetracked and forgot about this.
Now when I try to build it I'm getting an error (it builds fine without the changes).
running yarn --cwd <mydir> run gulp vscode-linux-x64
gives Error: monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.
I'm not sure exactly how I'm supposed to run gulp watch here. I don't know anything about yarn or gulp (I'm just using the VSCode contributor instructions), and running yarn --cwd <mydir> run gulp watch doesn't fix the problem.
It sounds like vscode/src/vs/monaco.d.ts being read by the build process before being written/updated, because its timestamp changes. I'm not sure if that's my fault and/or if it's a red herring.
Does anyone know what I should be doing here? Has anyone here modified the settings menu?
Is there any documentation out there for modifying the settings menu? (I had a look, didn't find anything).
I followed the Flow installation guide for npm & babel and when I get to the second stage where you flow init I keep getting the error message zsh command not found: flow. I installed flow into my project (a branch of my Gatsby blog) for testing/debugging purposes. It is not installed globally, which is what the Flow docs state is the best practice:
Flow works best when installed per-project with explicit versioning rather than globally.
I have been having a similar issue with Lume that returns zsh command not found: lume
If I enter echo $PATH
The colon delimited list should have user/local/.deno/bin:$PATH but it is not there. If I add it by running:
export PATH="/Users/yourUserName/.deno/bin:$PATH"
Than I am able to run lume commands. However, when I try to run lume commands the next day I have to go through the whole process once more as the error crops up again...
My question here today is regarding the Flow error and getting it sorted. I only mention the Lume error because it makes me fairly certain something is messed up in $Path or my Zsh config. I am just not sure what. The only caveat to that hunch though is that Deno is a global install, whereas Flow is installed directly into my project...
So, maybe the two errors while the same syntax are totally separate?
Thank you in advance for any guidance/suggestions. Cheers!
I came across this video from 2017 no less and the host had issues with flow not working within the project and so he installed it globally. I gave it a shot and the flow error zsh command not found: flow has been resolved...
first of all, i've never done something with github, this is my first try, so please be polite and help me on the train.
I would like to use this github-project:
https://github.com/jmmcatee/cracklord which is completly in go language.
from the instructions:
If you'd like to get things build from source, it will first require you to have a working Go build environment with the GOPATH setup. Additionally, you'll probably want Git and Mercurial setup to gather the various libraries and plugins that we've used in the code.
Here are my Questions:
I've done installing git and i'm able to clone the repro, which works fine.
I've installed mercurial, but have no idea how to "setup" mercurial.
Can someone explain what mercurial setup togehter with this githubproject example means?
why i'm asking
after creating a directory git-repos
changing into this directory with cd git-repos
path is now /root/git-repos
# set GOPATH to /root/git-repos
export GOPATH=/root/git-repos
and doing go get github.com/jmmcatee/cracklord
gives this error-message:
go get github.com/jmmcatee/cracklord
can't load package: package github.com/jmmcatee/cracklord: no Go files in /root/git-repos/src/github.com/jmmcatee/cracklord
okay.
So, when i'm following the instructions i'm not able to finish. Can someone explain what i'm doing wrong?
Thank you
Paul
You don't need to set gopath anymore, it is set by default to:
~/go
You don't say which os you're using, but given your paths I assume linux. I suspect you haven't exported the environment variable correctly. You might want to try setting up a simpler package first and verifying you have your go setup right. Follow the instructions here (including verifying your setup is working, and just using the default gopath):
https://golang.org/doc/install
And try downloading and running something simpler (which doesn't require several components installed) to verify your setup first.
If i run the following command from a DOS prompt:
hg parents --template {latesttag}
then I get the latest tag value returned as expected. However if I run the same command from within a powershell console I get the following error:
hg parents: option -i not recognized
I need the command to run in powershell so I can get it's results as a variable to use. Any idea what I need to do to get the command running?
You should just need to surround the argument to --template in quotes so that Powershell knows it's a string:
hg parents --template '{latesttag}'
Sometimes, however, with the way Powershell parses things you have to make doubly sure that double-quotes survive (such as passing an argument that contains spaces but should be 1 argument instead of many, like paths or a longer template):
hg parents --template '"{latesttag}"'
This answer comes with a huge disclaimer:
There might be better/different ways than this one, harnessing only PowerShell code, but I'm no PowerShell expert
I am the author of the following class library
I have made a .NET class library, Mercurial.Net that allows a .NET program to wrap around the hg command line client without having to deal with all the intricacies of doing all of that, waiting for the program to complete, etc. Note: You will need Mercurial installed, and available through the PATH for the class library to work.
It can be installed through Nuget package.
Since I'm no PowerShell expert, I'll show how to do this with C# code and my library.
Considering that the library does not implement all options (yet), sadly the parents command cannot be used by my library, but the log command can, although it will probably have more overhead. You will have to be the judge of whether this is acceptable.
The reason the parents command cannot be used is that I have, for now, decided not to implement support for the templating syntax in Mercurial, because then I know what kind of output to expect and can parse that back into proper .NET instances.
Here's the .NET code that would find the tipmost tag:
var repo = new Repository(".");
var tags = repo.Log(new LogCommand().WithRevision("tag()")).First().Tags.ToArray();
This will populate tags with an array of tag-names. The log command returns the log in reverse order, newest changesets first, so .First() will find the newest changeset.
If you need the closest tag that is also an ancestor of the current working folder, here's the changed code:
repo.Log(new LogCommand().WithRevision("tag() and ancestors(.)")).First().Tags...
^---------------^
This includes the revision of the working folder if that has a tag. If you need the ancestor, not including the revision of the working folder:
repo.Log(new LogCommand().WithRevision("tag() and ancestors(.) and not .")).First().Tags...
^--------^
I'm having a problem with writing my Bazaar plugin.
I've been trying a few different things, and this is the current state of my file:
''' Testing Bzr plugins '''
from bzrlib.commands import Command, register_command
version_info = (0,0,1, 'dev')
class cmd_test_foo(Command):
''' Testing is painful. '''
def run(self):
print "hi"
register_command(cmd_test_foo)
Here's what happens when I try to execute my command:
$bzr test-foo
hi
bzr: ERROR: unknown command "test-foo"
So that's really weird - it's obviously running my command, but tells me it's unknown?
Are there any good sources for plugin examples? I've looked at the builtins.py as suggested here but nothing there seemed to help.
Since I couldn't find any real information on this error on the web or SO, I decided I should post and answer my own question.
When Bazaar imports a plugin it creates a .pyc file just like normally importing from Python. If something magical happens - like editing it in one directory and forgetting to copy it, and then creating a symlink - it will never import the modifications. The register_command(cmd_test_foo) call is necessary for bazaar to register the command, where cmd_test_foo is your command name. When you call bzr help commands it will also show up like so:
$ bzr help commands
... (snip commands)
test-foo Testing is painful. [testCmd]
... (snip other commands)
and also
$ bzr plugins
testCmd 0.0.1.dev
Testing Bzr plugins
of course on that last one you'll also see any other plugins you may have installed.