command-line-interface

Change working directory in my current shell context when running Node script

不打扰是莪最后的温柔 提交于 2019-12-03 04:50:35
问题 I am trying to change the working directory of my Node.js script when it is run from a bin script. I have something like the following: #!/usr/bin/env node process.chdir('/Users') When I then run this file with ./bin/nodefile , it exits, but the working directory of the current shell context has not changed. I have also tried shelljs, but that does not work either. What is the best way to do this? I understand it's working but it's just in a separate process. 回答1: The correct way to change

Is there a definitive *nix command line tool for inspecting protocol buffers? [closed]

醉酒当歌 提交于 2019-12-03 04:43:47
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . I'm looking for a command-line utility that will, at a minimum, render binary protobuf data in human-readable form. Filtering and selection options (along the lines of cut for text) would be nice, but the primary object is to make the data visible for debugging purposes. If there is no definitive tool for the

How to pipe Node.js scripts together using the Unix | pipe (on the command line)?

十年热恋 提交于 2019-12-03 04:06:55
问题 I see how to pipe stuff together using Node.js streams, but how do you pipe multiple scripts together using the Unix | , given that some of these scripts can be async? $ ./a.js | ./b.js Example: a.js (chmod 0755) #!/usr/bin/env node setTimeout(function(){ console.log(JSON.stringify({ foo: 'bar' })); }, 10); b.js (chmod 0755) #!/usr/bin/env node console.log(process.argv); This is the output: $ ./a.js | ./b.js [ 'node', '/Users/viatropos/tests/b.js' ] events.js:72 throw er; // Unhandled 'error'

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

拥有回忆 提交于 2019-12-03 03:58:25
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. The following EVAL script should do what you want: local keys = redis.call('KEYS',KEYS[1]) for i,k in ipairs(keys) do

Linux - moving the console cursor visual

泄露秘密 提交于 2019-12-03 03:51:18
I'm currently designing a CLI interface for linux, and for various reasons I am not able to use ncurses . I am using exclusively C++ and the Qt framework. Therefore, in order to have a user-friendly interface, I have to run this getch loop in a separate thread: https://stackoverflow.com/a/912796/3605689 Which basically means I have to implement all basic functionalities (such as backspace) by myself. I have already implemented command completion and command history(like when you press tab or uparrow/downarrow in linux), but I can't figure out how to implement leftarrow/rightarrow (aka seeking

XDebug: how to debug remote console application?

半腔热情 提交于 2019-12-03 03:25:46
问题 I have read this docs: http://xdebug.org/docs/remote I can debug my web application. But the debugger doesn't launch for console command. My .ini file for XDebug (it works): $ cat /etc/php5/fpm/conf.d/xdebug.ini zend_extension=/usr/lib/php5/20090626/xdebug.so xdebug.idekey="PHPSTORM" xdebug.remote_connect_back=1 xdebug.remote_enable=1 .ini file for cli is the same. Also I tried to add export XDEBUG_CONFIG="idekey=PHPSTORM remote_enable=1 remote_connect_back=1" before debugging, but it didn't

How to remove globally a package from Composer?

為{幸葍}努か 提交于 2019-12-03 02:48:40
问题 I ran this command to install globally PHPUnit : composer global require 'phpunit/phpunit=3.7.*' Now I want to uninstall globally PHPUnit . Any ideas? 回答1: To remove a globally installed package run: composer global remove phpunit/phpunit global command lets you to run many commands like install , require or update as if you were running them from the COMPOSER_HOME directory. Read the related documentation here: http://getcomposer.org/doc/03-cli.md#global COMPOSER_HOME depends on your system

How do I delete a versioned bucket in AWS S3 using the CLI?

天涯浪子 提交于 2019-12-03 02:36:46
问题 I have tried both s3cmd : $ s3cmd -r -f -v del s3://my-versioned-bucket/ And the AWS CLI: $ aws s3 rm s3://my-versioned-bucket/ --recursive But both of these commands simply add DELETE markers to S3. The command for removing a bucket also doesn't work (from the AWS CLI): $ aws s3 rb s3://my-versioned-bucket/ --force Cleaning up. Please wait... Completed 1 part(s) with ... file(s) remaining remove_bucket failed: s3://my-versioned-bucket/ A client error (BucketNotEmpty) occurred when calling

Can't see what I'm typing in iterm2

我的未来我决定 提交于 2019-12-03 02:04:16
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 weird indention remains: Typing "stty sane" Fixes this for me. Clean up this and many other issues

How to make a shell executable node file using TypeScript

让人想犯罪 __ 提交于 2019-12-03 01:56:23
Normally in node files I just put #!/usr/bin/env node at the top and make it executable to create a file that can be run from a bash terminal. However if I do that in a Typescript file, the compiler says "error TS1001: Unexpected character "#"" and refuses to compile it. So how can I make a shell executable node file with Typescript? You were right to report the bug to Microsoft, and they were wrong to close it as wontfix . Until it is fixed, here's a workaround. Paste the following into a text file and save it as shebangify : #!/usr/bin/env node var fs = require('fs'); var path = process.argv