command-line-interface

Symfony Console - Overwrite default options

自闭症网瘾萝莉.ら 提交于 2019-12-07 05:35:35
问题 I'm building a CLI application for my app using Symfony Console. The application is required to do some simple package management operations to manage plugins. Therefore, I need a command option named --version with shortcut -v , which does not seem to be possible since --version is reserved for the application version and -v is reserved for the default verbosity setting. How can I either disable the default options or overwrite them for this subcommand? The error popping up states [Symfony

issue when calling executable in a path that has space

一个人想着一个人 提交于 2019-12-07 05:24:10
问题 I just installed R on a new Microsoft Windows 7 computer and I am running in the following error when using command line: "C:\Program Files\R\R-3.3.2\bin\Rscript.exe" --version 'C:\Program' is not recognized as an internal or external command, operable program or batch file. Note that I have added above the quotes around the path with a space. And that I have added in the system path: ;C:\Program Files\R\R-3.3.2\bin\ Interestingly: if I just call this Rscript.exe --version it gives the same

Run Swift 3 from command line using Xcode 8 Beta

旧巷老猫 提交于 2019-12-07 05:15:33
问题 Can I run Swift 3 from the command line after installing the Xcode 8 beta? I see that /usr/bin/swift is still the May 5th Swift 2.2. I was hoping to see something like /usr/bin/swift3 but no such luck. swift.org downloads says that "Swift 3.0 Preview 1 is available as part of Xcode 8.0 beta." But I haven't found instructions on running a command line Swift 3 using the Xcode 8 beta. Ideally, I would like to use the interactive REPL ... as well as do command-line compilation of Swift Package

Batch Script - Create user in Windows XP programmatically

眉间皱痕 提交于 2019-12-07 04:56:19
问题 Is there a way to create a user in Windows XP via Batch Script and even assign it administrator/limited user value? 回答1: Suppose the username is rased and password is pAsS net user rased pAsS /add net localgroup administrators rased /add here user is added under administrators group. 回答2: Yes, you can create a user by running net user USERNAME PASSWORD /add (omit the PASSWORD if you do not wish to have a password for this account, use * for PASSWORD to require the user to enter a password at

How to write unit tests for Inquirer.js?

此生再无相见时 提交于 2019-12-07 04:55:56
问题 I was wondering how to write unit tests for the npm package Inquirer.js, which is a tool to make CLI package more easily. I have read this post but I was't able to make it works. Here is my code that needs to be tested: const questions = [ { type: 'input', name: 'email', message: "What's your email ?", }, { type: 'password', name: 'password', message: 'Enter your password (it will not be saved neither communicate for other purpose than archiving)' } ]; inquirer.prompt(questions).then(answers

export shell environment variable before running command from PHP CLI script

馋奶兔 提交于 2019-12-07 02:47:12
问题 I have a script that uses passthru() to run a command. I need to set some shell environment variables before running this command, otherwise it will fail to find it's libraries. I've tried the following: putenv("LD_LIBRARY_PATH=/path/to/lib"); passthru($cmd); Using putenv() doesn't appear to propagate to the command I'm running. It fails saying it can't find it libraries. When I run export LD_LIBRARY_PATH=/path/to/lib in bash, it works fine. I also tried the following (in vain): exec("export

Splitting a command line in Java

空扰寡人 提交于 2019-12-07 00:35:55
问题 What's the recommended way to parse a shell-like command line in Java. By that I don't mean processing the options when they are already in array form (e.g. handling "-x" and such), there are loads of questions and answers about that already. No, I mean the splitting of a full command string into "tokens". I need to convert a string such as: user 123712378 suspend "They are \"bad guys\"" Or\ are\ they? ...to the list/array: user 123712378 suspend They are "bad guys" Or are they? I'm currently

Use different filename for npm than “package.json”

人走茶凉 提交于 2019-12-07 00:18:05
问题 Is there a way to tell npm from the command line to use a different file than "package.json"? Edit: Thank you for your answers. I already checked the docs and hoped there was a workaround or a non-documented way to achieve that. I'll think of something else then. 回答1: Using only client-space tools, it seems pretty straightforward you can't. npm doc is positive about this : A package is: a) a folder containing a program described by a package.json file b) a gzipped tarball containing (a) c) a

Automate Heroku CLI login

岁酱吖の 提交于 2019-12-06 23:47:50
问题 I'm developing a bash script to automatic clone some projects and another task in dev VM's, but we have one project in Heroku and repository is in it. In my .sh file I have: > heroku login And this prompt to enter credentials, I read the "help" guide included on binary and documentation but I can't found anything to automatic insert username and password, I want something like this: > heroku login -u someUser -p mySecurePassword Exist any way similar to it? 回答1: The Heroku CLI only uses your

macOS: Detect all application launches including background apps?

邮差的信 提交于 2019-12-06 18:14:27
Newbie here. I'm trying to create a small listener for application launches, and I already have this: // almon.m #import <Cocoa/Cocoa.h> #import <stdio.h> #include <signal.h> @interface almon: NSObject {} -(id) init; -(void) launchedApp: (NSNotification*) notification; @end @implementation almon -(id) init { NSNotificationCenter * notify = [[NSWorkspace sharedWorkspace] notificationCenter]; [notify addObserver: self selector: @selector(launchedApp:) name: @"NSWorkspaceWillLaunchApplicationNotification" object: nil ]; fprintf(stderr,"Listening...\n"); [[NSRunLoop currentRunLoop] run]; fprintf