command-line-interface

How to write using BCP to a remote SQL Server?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 12:11:15
I have a remote SQL Server with a hostname I am using to connect to. BCP suggests to use bcp DBName.dbo.tablename in C:\test\yourfile.txt -c -T -t However when I try this it does not connect to DBName as that is not a valid alias. I get native error 2. How to I run BCP but specify an internet / network address to connect to, not an MSSQL server name? How to I run BCP but specify an internet / network address to connect to, not an MSSQL server name? You can specify the IP address (here just 127.0.0.1) instead of the server name. bcp DBName.dbo.tablename in "C:\test\yourfile.txt" -c -T -t -S"127

Determining whether STDERR is going to terminal

旧街凉风 提交于 2019-12-05 11:35:50
I have a suite of Java programs which are used as command-line tools on our Linux servers. Most of them use a class that prints a progress bar on STDERR, similar to Perl's Term::ProgressBar . I'd like to have the progress bar shown whenever STDERR is going to the terminal and automatically disable itself when STDERR is redirected so that there aren't all sorts of progress bar pieces in the redirected data. Checking System.console() == null was my first thought, but redirecting STDOUT is enough to make this true , even if STDERR is still going to the terminal. Is there anything I can check that

Batch Script - Create user in Windows XP programmatically

╄→гoц情女王★ 提交于 2019-12-05 11:27:57
Is there a way to create a user in Windows XP via Batch Script and even assign it administrator/limited user value? 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. 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 run time). This creates a "limited user"; if you wish to make the new user an administrator, run net localgroup

Run Swift 3 from command line using Xcode 8 Beta

↘锁芯ラ 提交于 2019-12-05 10:03:35
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 Manager code. sudo xcode-select -s /Applications/Xcode-beta.app swift Run Xcode-Beta and change Command

How to write unit tests for Inquirer.js?

孤街醉人 提交于 2019-12-05 09:41:21
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 => { const user = create_user(answers.email, answers.password); let guessing = guess_unix_login(user);

how to make a Command Line Interface or Interpreter in python

心已入冬 提交于 2019-12-05 09:38:45
guys. I have seen some CLI questions here, but I still want to ask this question for more detailed answers. I have already developed class1.py, class2.py, etc. with functions implemented inside each class. e.g. Operator.py has add, minus,time, devide functions. how can I build a command line interface for these classes? also for this CLI, is it a infinite loop inside the main() for interaction? And how can the CLI give some feedback such as, suggesting the user for the next operation or to input right command or type --help and check all the available commands. like the Bash shells. also it

Python CLI to edit Firefox bookmarks?

∥☆過路亽.° 提交于 2019-12-05 07:53:06
问题 Has anyone done a Python CLI to edit Firefox bookmarks ? My worldview is that of Unix file trees; I want find /re/ in given or all fields in given or all subtrees cd ls with context mv this ../there/ Whether it uses bookamrks.html or places.sqlite is secondary -- whatever's easier. Clarification added: I'd be happy to quit Firefox, edit bookmarks in the CLI, import the new database in Firefox. In otherwords, database locking is a moot point; first let's see code for a rough cut CLI. (Why a

Is it possible to add a global argument for all subcommands in Click based interfaces?

余生长醉 提交于 2019-12-05 06:06:00
I am using Click under a virtualenv and use the entry_point directive in setuptools to map the root to a function called dispatch. My tool exposes two subcommands serve and config , I am using an option on the top level group to ensure that the user always passes a --path directive. However the usage turns out as follows: mycommand --path=/tmp serve both the serve and config sub commands need to ensure that the user always passes a path in and ideally I would like to present the cli as: mycommand serve /tmp` or `mycommand config validate /tmp current Click based implemenation is as follows: #

export shell environment variable before running command from PHP CLI script

◇◆丶佛笑我妖孽 提交于 2019-12-05 04:45:05
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 LD_LIBRARY_PATH=/path/to/lib"); passthru($cmd); How can I set a shell variable from PHP, that

How to use the --verbose flag in the MySQL 5.6 command line client?

狂风中的少年 提交于 2019-12-05 03:59:25
Going by the list of flags here , with the line at the top about usage: Usage: mysql [OPTIONS] [database] . I am running Windows 8; my table is "contact"; I want to create a tee file for source C:/myfile.sql with the verbose option on. I have tried mysql -v contact , -v contact , --verbose contact , --verbose source C:/myfile.sql , and various others. EDIT: adding screenshot of where I'm trying to run this, in case it helps. The correct syntax for a verbose interactive session is: c:\> mysql -u yourUser -p -v yourDatabase This will launch an interactive session (prompting you for password),