command-line-interface

Best approach for git-like interface

旧街凉风 提交于 2019-12-23 18:16:40
问题 I'm writing a little command line todo app that has a general git-like interface. It has several tasks it can perform: add , list , complete , ... all of these should be accessible via the todo <task> interface. Eg todo list . Like with git, some of these task take variables or options, and the todo app can also take options (which are applicable to any type of task, e.g. the location of the config file). Eventually one should be able to write something like: todo -c ~/.config/todorc add -

Execute Java programs in a consistent environment

霸气de小男生 提交于 2019-12-23 16:43:41
问题 Where I work we have a shell script that allow us to execute arbitrary Java classes with all the necessary libraries and settings, something like: #!/bin/sh $JAVA_HOME/bin/java -cp LONG_LIST_OF_JARS -Xmx6g -XX:MaxPermSize=128m "$@" And used like so: javacorp.sh com.mycorp.SomeJob This is obviously better than needing to specify all the java arguments explicitly every time, but I dislike that it's only manually connected to the jars configured in our Eclipse project for compiling the codebase.

python script works in spyder console but not in spyder ipython or cmd in windows

假装没事ソ 提交于 2019-12-23 16:16:17
问题 I am trying to run this python script from How to connect to TT X_TRADER API in order to create an automated trading system using python? import pythoncom from time import sleep from win32com.client import Dispatch, DispatchWithEvents, getevents from win32com.client.gencache import EnsureDispatch, EnsureModule GATE = None NOTIFY = None class InstrNotify(getevents('XTAPI.TTInstrNotify')): def __init__(self): pass def Subscribe(self, pInstr): self.AttachInstrument(pInstr) pInstr.Open(0) def

What is the -y flag used for in apt-get install? [closed]

怎甘沉沦 提交于 2019-12-23 10:41:14
问题 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 last year . What does the -y flag do when you're running apt-get install ? Example, from https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions: sudo apt-get install -y nodejs 回答1: It skips the confirmation of the installation. When you install a package, Ubuntu asks for confirmation (Y/N)

Java command line interface: having multiple progress bars on different lines using '\r'

天涯浪子 提交于 2019-12-23 09:29:57
问题 Part of the command line interface for a program I'm writing calls for multiple progress bars. I can currently update a single line in the console by using the \r escape sequence with something similar to this: System.out.printf("\rProcess is %d%% complete", percentageComplete); However the carriage return only goes back to the start of that line. I want a way of going back two lines (or more generally, any number of lines) and have them both/all update. Is there any way of doing this? 回答1: I

Call a click command from code

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 07:53:35
问题 I have a function which is wrapped as a command using click. So it looks like this: @click.command() @click.option('-w', '--width', type=int, help="Some helping message", default=0) [... some other options ...] def app(width, [... some other option arguments...]): [... function code...] I have different use cases for this function. Sometimes, calling it through the command line is fine, but sometime I would also like to call directly the function from file_name import app width = 45 app(45, [

What is the PHP exec() return value?

空扰寡人 提交于 2019-12-23 07:34:00
问题 I am trying to use the PHP exec() function. If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable. If the execution was successful, it's 0. However, if there is an error, it can be a multitude of other integers. I can't seem to find anywhere what those integers correspond to. How should I interpret the integer that I get? Update: I really should have specified this originally, but I am executing

Login to Docker Hub from PHP script

▼魔方 西西 提交于 2019-12-23 02:19:08
问题 I am trying to login and push Docker images from a PHP script as part of our CICD process. Here is the code: <?php include '../php/database.php'; $duser = 'username'; $dpass = 'password'; $dmail = 'email'; $tag = 'from system'; function tagImage($tag) { $getImageID = "SELECT `imageID` FROM `docker_images` WHERE `tag` = :tag "; $params = array(':tag' => $tag); $results = dataQuery($getImageID, $params); if(!empty($results)) { $image = $results[0]['imageID']; global $repo = $results[0]['repo'];

Login to Docker Hub from PHP script

混江龙づ霸主 提交于 2019-12-23 02:19:00
问题 I am trying to login and push Docker images from a PHP script as part of our CICD process. Here is the code: <?php include '../php/database.php'; $duser = 'username'; $dpass = 'password'; $dmail = 'email'; $tag = 'from system'; function tagImage($tag) { $getImageID = "SELECT `imageID` FROM `docker_images` WHERE `tag` = :tag "; $params = array(':tag' => $tag); $results = dataQuery($getImageID, $params); if(!empty($results)) { $image = $results[0]['imageID']; global $repo = $results[0]['repo'];

Is there a Ruby equivalent to the C++ std::setw(int) function?

一世执手 提交于 2019-12-23 02:18:10
问题 I am outputting some text tables to a terminal and would like to be able to use something like the C++ std::setw() function to provide padding for my output rather than guessing at the number of spaces or tabs required. Before I go knock together something to do this, is there already a function or Ruby Gem which does this? Std::setw() for those who need a few cobwebs flow out (like me) http://www.cplusplus.com/reference/iostream/manipulators/setw/ I am using Ruby 1.8 at present so a solution