command-line-interface

Adding colors to terminal prompt results in large white space

a 夏天 提交于 2019-12-03 16:57:11
I'm working on a simple cli script and wanted to add some color to the following code: rl.question('Enter destination path: ', function(answer) { // ... }); rl.write('/home/' + user + '/bin'); Which displays in the terminal: Enter destination path: /home/jmcateer/bin_ But I wanted to add some color to the prompt I did the following: rl.question('\u001b[1;36mEnter destination path:\u001b[0m ', function(answer) { }); rl.write('/home/' + user + '/bin'); And the command line prompt ended up displaying: Enter destination path: /home/jmcateer/bin_ It works but there's a huge amount of white space I

How can I perform a diff that ignores all comments?

别等时光非礼了梦想. 提交于 2019-12-03 15:44:42
问题 I have a large codebase that was forked from the original project and I'm trying to track down all the differences from the original. A lot of the file edits consist of commented out debugging code and other miscellaneous comments. The GUI diff/merge tool called Meld under Ubuntu can ignore comments, but only single line comments. Is there any other convenient way of finding only the non-comment diffs, either using a GUI tool or linux command line tools? In case it makes a difference, the

Windows equivalent of the Mac OS X “open” command

梦想的初衷 提交于 2019-12-03 15:31:33
问题 Liu Chang asked a very similar question to this one here, Linux equivalent of the Mac OS X "open" command. Is there a windows equivalent for the Mac OS X "open" command. I'm trying to run a profiler that will open it's results, but it's looking for the "open" command. Basically, the command needs to open a file from the command prompt as if it were double-clicked on in explorer. 回答1: The closest thing available is start . If its first argument is double-quoted, that argument is treated as a

delete redis hash values in bulk based on the hash key name

限于喜欢 提交于 2019-12-03 14:07:00
问题 Similar to this, but needing a solution for hashes instead of plain keys: How to atomically delete keys matching a pattern using Redis I have a bunch of hashes with prefix like: "prefix:" Under each hash are a bunch of keys like: "cc_XX", where "XX" is a 2 letter code. I need to some how loop through all my redis hashes, and delete each of the cc_XX sub keys some how, and am looking for a cli/lua way to do this (not great with either). Any advice would be greatly appreciated. 回答1: The

doctrine2 autloader with cli must use AnnotationRegistry

倾然丶 夕夏残阳落幕 提交于 2019-12-03 13:33:51
问题 I must use \Doctrine\Common\Annotations\AnnotationRegistry::registerFile to access the annotation registry in entity files. This part is required to use driver chain and using orm:schema-tool:creator. but i cant add each class i needed by adding AnnotationRegistry::registerFile . this problem was see when i want to add Gedmo to my Doctrine 2.2.2. // cli-config.php // if comment this like an error will appear // \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(__DIR__ . '/..

Interact with a locally long-running Common Lisp image, possibly daemonized, from the command line

不想你离开。 提交于 2019-12-03 12:50:53
How could one interact with a locally long-running Common Lisp image, possibly daemonized, from the command line? I know it is possible to run a Common Lisp function from a Terminal command prompt , I am also aware of this . I would need to do a similar thing, but with a local, already long-running Common Lisp image, being able to poll available functions from the CLI or shell scripts. Is there a way to do that from a CLI, for example calling a function from a bash script, and receiving back whatever the function returns? I though one could, for example, create a primitive web service, perhaps

include file in project from command line

不问归期 提交于 2019-12-03 12:46:31
Is there a way to include a file in project from command line in vs2012 ? The reason why I'm asking is because is very frustrating to include any new file I add to the project folder whenever I use some other IDE ( like ST3 ) or when I save a file from Photoshop, etc. I'm using Grunt for doing a lot of minifying, concatenation, running ngmin on my angular scripts, etc. There's a grunt-shell plugin that allows grunt tasks to run shell commands ( I'm already using it for unlocking locked files by TFS ). So I was thinking that I could create a task that would do the include in project for me for

Cordova install on Linux

空扰寡人 提交于 2019-12-03 12:45:18
Does anyone know how to install Cordova on Ubuntu/xUbuntu? My attempts at executing npm install cordova as directed from the link and other sources don't work. I get the following long error message: root@li141-82:/var/www/mysite# npm install cordova npm http GET https://registry.npmjs.org/cordova npm ERR! Error: failed to fetch from registry: cordova npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12 npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9) npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)

How to enable autocomplete in iTerm2

谁说我不能喝 提交于 2019-12-03 12:21:54
Let's say I'm in my root directory, and I have a User folder that I can cd into. In my default Mac terminal, I can just type cd U + tab , and it autocompletes to cd Users/ . How do I get this to work in iTerm2? It used to work just fine in iTerm2, but I must have changed a setting somewhere that disabled it, and I cannot figure out how to get it back. Autocomplete in iTerm2 activates by pressing cmd + ; You can install bash-completion package to autocomplete by Tab key. Install bash-completion with brew In Iterm 2 , you can activate Autocomplete by pressing command ⌘ + ; 来源: https:/

Can't see what I'm typing in iterm2

狂风中的少年 提交于 2019-12-03 11:36:21
问题 Periodically, I'll run rspec (though I don't know if its specific to that) and suddenly, I can't see what i'm typing. I have to close that iterm2 window out and open a new one. Then that will work fine for a while and iterm2 will hide my typing again. I can always see responses to my commands, just not my typing or cursor. It also does this weird stacking thing where it pushes each new line farther to the right. Update!: I tried the suggestion to type in stty echo and can see my text, but the