command-line-interface

How can I capture CLI tool file output to R object or stdout?

北城以北 提交于 2019-12-11 09:13:00
问题 I'm calling a bunch of command-line interface (CLI) tools (such as texi2pdf or pdf2svg from an R script, and I'd like to capture the output file of these tools directly as an R object, without touching the file system . This is the opposite concern of the more frequent "how-do-I-redirect-stdout-to-file"-question. (Perhaps that implies that I'm "using it wrong"). Example : Say, I have a simple latex reprex.tex file that I'd like to compile: \documentclass{article} \begin{document} Foo. \end

How to pull files from Cloud Foundry on Diego

我只是一个虾纸丫 提交于 2019-12-11 08:54:23
问题 I would like to retrieve some application's logs. I found that the command cf file was not available anymore and the plugin cf-download doesn't work on Diego Architecture. Is there a way to retrieve files from the cloud foundry by CLI other another method? 回答1: The solution is to use SSH without cf CLI When you are at the step 4) you can use WinSCP (for Windows) to have a graphical interface to navigate in the folders. 来源: https://stackoverflow.com/questions/48499625/how-to-pull-files-from

cannot have multiple subparser arguments

Deadly 提交于 2019-12-11 08:47:01
问题 So i'm trying to build an CLI with the following pattern: cli.py api new --config config.json or cli.py api del [api_name] To achieve the api i've added it as sup parser if __name__ == '__main__': parser = argparse.ArgumentParser(prog='my prog') subparsers = parser.add_subparsers(title='api', help='available actions') api_parser = subparsers.add_parser('api') from here i thought that we might want to add two new subparsers to handle the new and del subcommands: if __name__ == '__main__':

php: mysql_connect() failing with no error message

牧云@^-^@ 提交于 2019-12-11 08:32:20
问题 I am running a simple test script from the command line on CentOS 5.6 with the PHP package installed from PHP 5.3 on CentOS/RHEL 5.6. PHP runs fine in all other cases but when I hit mysql_connect() it fails without error. If I run $ php -m I am not seeing MySQL as an installed module. However I have added extension=mysql.so to my php.ini and rebooted. Output of 'rpm -qa | grep php' php-common-5.3.10-1.w5 php-5.3.10-1.w5 php-cli-5.3.10-1.w5 Output of 'yum install php-mysql' --> Missing

Cucumber Aruba trying to change directory results in a strange error

三世轮回 提交于 2019-12-11 07:45:16
问题 So I create the dotfiles directory and then cd to dotfiles. However, cucumber aruba is giving me an error that says dotfiles is not a directory. I can't figure out why this is? the code in pry results in the correct behavior. @creation Scenario: Create a dotfiles git repository Given the directory dotfiles does not exist in the home directory When I successfully run `dotfiles init dotfile_one dotfile_two dotfile_three` Then a dotfiles directory should exist in the home directory When I change

Ubuntu Zend Framework cli securityCheck Error

安稳与你 提交于 2019-12-11 07:36:41
问题 I followed all the instructions. I am on Ubuntu 10.10. using Zend Server Ce. In my .bashrc I have ld_library_path, zend framework library, etc. I can run zf, but its giving an error: Fatal error: Uncaught exception 'Zend_Exception' with message 'Security check: Illegal character in filename' in /usr/local/zend/share/ZendFramework/library/Zend/Loader.php:303 Stack trace: #0 /usr/local/zend/share/ZendFramework/library/Zend/Loader.php(128): Zend_Loader::_securityCheck('Zend/Tool/Proje...') #1

How to call a PHP function from CLI?

十年热恋 提交于 2019-12-11 07:36:35
问题 Let's say I have a private function addUser() in function.php that takes $username as an input variable and does some stuff: function addUser($username) { //do some stuff } Now I want to call this function and pass the value $username, if possible with PHP CLI. I guess that won't work from outside function.php since it's private, but how could I do this then? 回答1: php -r 'include("/absolute/path/to/function.php"); addUser("some user");' This should work. Because you are basically executing

Buffering problem when piping output between CLI programs

二次信任 提交于 2019-12-11 07:36:26
问题 I'm trying to tail apache error logs through a few filters. This works perfectly: tail -fn0 /var/log/apache2/error.log | egrep -v "PHP Notice|File does not exist" but there are some literal "\n" in the output which I want to replace with an actual new line so I pipe into perl: tail -fn0 /var/log/apache2/error.log | egrep -v "PHP Notice|File does not exist" | perl -ne 's/\\n/\n/g; print"$_"' This seems to have some caching issue (first page hit produces nothing, second page hit and two loads

How can you access the second argument of the second to last command at the cli?

旧街凉风 提交于 2019-12-11 07:33:03
问题 For example: ~ echo foo bar baz foo bar baz ~ echo catz ratz batz catz ratz batz ~ echo !!:2 #=> ratz In this case the !!:2 accesses the second argument of the last command. Is it possible to get the second argument of the second to last command which in this case would expand to bar ? 回答1: As illustrated by @Jahid in a previous post: Second argument of the second to last command: ~ $ echo foo bar baz # This one is the target foo bar baz ~ $ echo catz ratz batz catz ratz batz ~ $ echo !-2:2

auto_prepend_file is not working in cli mode

 ̄綄美尐妖づ 提交于 2019-12-11 07:17:43
问题 I cannot get an auto_prepend_file run on my mac: # cat /opt/local/lib/php/test.php <?php function test() { return 'foo'; } # php --ini | grep php.ini Configuration File (php.ini) Path: /opt/local/etc/php5 Loaded Configuration File: /opt/local/etc/php5/php.ini # cat /opt/local/etc/php5/php.ini | grep auto_prepend_file auto_prepend_file = "/opt/local/lib/php/test.php" # ls -la /opt/local/etc/php5/php.ini -rw-r--r-- 1 root admin 68630 Jul 27 13:53 /opt/local/etc/php5/php.ini # php -r "echo ini