command-line-interface

pytest - specify log level from the CLI command running the tests

喜夏-厌秋 提交于 2019-12-21 02:50:35
问题 my team and I are using Pytest + Jenkins to automate our product testing. we have been using the standard Logging lib of python to get proper log messages during testing, before and after each test etc. we have multiple layers of logging, we log out ERROR, WARNING, INFO and DEBUG. the default value for our logger is INFO. we create the logger object in the primary setup of the tests, and pass it down to each object created, so all our logs go to the same logger. so far when we are developing

Creating a shell command line application with Python and Click

耗尽温柔 提交于 2019-12-20 12:36:44
问题 I'm using click (http://click.pocoo.org/3/) to create a command line application, but I don't know how to create a shell for this application. Suppose I'm writing a program called test and I have commands called subtest1 and subtest2 I was able to make it work from terminal like: $ test subtest1 $ test subtest2 But what I was thinking about is a shell, so I could do: $ test >> subtest1 >> subtest2 Is this possible with click? 回答1: This is not impossible with click, but there's no built-in

XMLStarlet does not select anything

北城余情 提交于 2019-12-20 11:45:13
问题 I have a typical pom.xml, and want to print the groupId, artifactId and version, separated by colon. I think that XMLStarlet is the right tool for that. I tried several ways, but I always get an empty line. xml sel -t -m project -v groupId -o : -v artifactId -o : -v version pom.xml Expected output: org.something.apps:app-acct:5.4 Real output: empty line Even if I try to print just the groupId I get nothing: xml sel -t -v project/groupId pom.xml I am sure that the tool sees the elements

'touch' is not recognized as an internal or external command, operable program or batch file

懵懂的女人 提交于 2019-12-20 10:34:22
问题 I work with laravel 5 , when i type in windows cmd this command "touch storage\database.sqlite" this error message rise 'touch' is not recognized as an internal or external command, operable program or batch file. any hint to solve it ? 回答1: if you are using node.js just use npm to install it on Windows: C:\npm install touch-cli -g it will install the command line interface for touch, you can then use it the same as unix... 回答2: The command you're trying to run is a unix/linux based command

PHP APC in CLI mode

China☆狼群 提交于 2019-12-20 09:53:28
问题 Does APC module in PHP when running in CLI mode support code optimization? For example, when I run a file with php -f <file> will the file be optimized with APC before executing or not? Presuming APC is set to load in config file. Also, will the scripts included with require_once be also optimized? I know optimization works fine when running in fastcgi mode, but I'm wondering if it also works in CLI. apc_* functions work, but I'm wondering about the code optimization, which is the main thing

Symfony2: how to set the host/base url in CLI scripts

↘锁芯ラ 提交于 2019-12-20 09:37:06
问题 I'm currently writing a newsletter tool, and therefore have to generate absolute URLs in a CLI script which is called via cron. Unfortunately the Symfony CLI command does not know anything about my host/base_url, so the router generates absolute URLs with a wrong base_url. It always uses http://localhost as base. Is there a way to tell the router the correct base_url? My code: $this->container->get('router')->generate($route, $parameters, true); 回答1: You can do it in this way: $host = $this-

De-activate a maven profile from command line

不羁的心 提交于 2019-12-20 09:08:30
问题 I have a profile activated by default in my maven setting file ~/.m2/settings.xml . Is it possible to deactivate it from the command line by doing something like this: mvn -P!profileActivatedByDefault 回答1: Yes indeed, you have the right way. From maven profiles user guide Deactivating a profile Starting with Maven 2.0.10, one or more profiles can be deactivated using the command line by prefixing their identifier with either the character '!' or '-' as shown below: mvn groupId:artifactId:goal

Delete node_modules folder recursively from a specified path using command line

萝らか妹 提交于 2019-12-20 07:59:43
问题 I have multiple npm projects saved in a local directory. Now I want to take backup of my projects without the node_modules folder, as it is taking a lot of space and can also be retrieved any time using npm install . So, I need a solution to delete all node_modules folders recursively from a specified path using the command line interface. Any suggestions/ help is highly appreciable. 回答1: Print out a list of directories to be deleted: find . -name 'node_modules' -type d -prune Delete

How to change the cmd's current-dir using PowerShell?

感情迁移 提交于 2019-12-20 05:43:12
问题 I read some file using PowerShell , and change current dir accordingly, but all I can do is change the current PowerShell 's current dir, not the caller's dir (the cmd.exe environment that called that ps1 file). Things I tried: powershell ch-dir.ps1 | cd (won't work, obviously, since CD is internal command) powershell cd $myDir (changes current dir in PowerShell , but when script exits, the cmd environment still in original dir) I really hope I won't need to find the script's caller process

Adding libraries/Frameworks to Xcode project using the command line?

我的未来我决定 提交于 2019-12-20 02:54:10
问题 I am looking for a way to add libraries to an Xcode project, using the command line. I have been successful in adding files to groups with the XCS tool, but it does not support libraries. I would, for example, like to be able to add CoreVideo.framework to a specific project with a command on the Terminal. 回答1: This project can handle frameworks: https://github.com/kronenthaler/mod-pbxproj Just add it as a normal file, it will figure out the correct type and how to set everything up (i.e., add