command-line-interface

Linux - moving the console cursor visual

吃可爱长大的小学妹 提交于 2019-12-04 09:43:53
问题 I'm currently designing a CLI interface for linux, and for various reasons I am not able to use ncurses . I am using exclusively C++ and the Qt framework. Therefore, in order to have a user-friendly interface, I have to run this getch loop in a separate thread: https://stackoverflow.com/a/912796/3605689 Which basically means I have to implement all basic functionalities (such as backspace) by myself. I have already implemented command completion and command history(like when you press tab or

Use Flask's Click CLI with the app factory pattern

被刻印的时光 ゝ 提交于 2019-12-04 09:28:35
问题 I define my Flask application using the app factory pattern. When using Flask-Script, I can pass the factory function to the Manager . I'd like to use Flask's built-in Click CLI instead. How do I use the factory with Click? My current code uses Flask-Script. How do I do this with Click? from flask import Flask from flask_script import Manager, Shell def create_app(): app = Flask(__name__) ... return app manager = Manager(create_app) def make_shell_context(): return dict(app=app, db=db, User

How to configure Mac OS X term so that git has color? [closed]

醉酒当歌 提交于 2019-12-04 07:38:51
问题 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 7 years ago . I've seen a Mac OS X git demo online in which it's configured to have multiple colors. For example, his prompt is amber, his ls directory is purple and his git diff output has ~ 4 colors (pink, light green, red, pale yellow). Can you tell me how can I configure Mac OS X terminal to achieve that? It's definitely

Creating a CLI (Shell?) in Python

自古美人都是妖i 提交于 2019-12-04 07:33:36
I am very newbie in Python but I have to implement for school a command line interpreter in Python language, but I am kinda lost in how to do that. I have already read some tutorials and created a simple file called functions.py where i include some simple functions like this: def delete(loc): if os.path.exists(loc) == True: os.remove(loc) print "Removed" else: print "File not exists" Now.. here is the thing.. in order to use this I must import it inside the python command interpreter, like... import functions functions.delete("file to delete") How can I make a Shell/CLI so instead of have to

How do I use babel in a node CLI program?

情到浓时终转凉″ 提交于 2019-12-04 06:30:53
问题 I'm writing a small CLI tool in node and would like to use ES6 for that. index.js looks like: #!/usr/bin/env node require('babel/register'); module.exports = require('./app'); I can easily invoke that using $ node index.js --foo some --bar thing In my package.json I declare the following: "bin": { "my-tool": "./index.js" } When installing and executing this it seems that babel is not working as I am getting: /usr/lib/node_modules/my-tool/app.es6:1 (function (exports, require, module, _

Is there a way to check before adding module to JBoss using CLI?

℡╲_俬逩灬. 提交于 2019-12-04 05:56:15
Is there a way to check module hasn't already been added before calling adding using JBoss CLI? e.g. module add --name=org.mysql --resources=/home/abc/drivers/mysql/MySQL5.jar # Want to do similar check for module add if (outcome != success) of /subsystem=datasources/jdbc-driver=org.mysql:read-resource # Add it... end-if Reason is trying to add a module that already exists causes an error. When in domain mode, you can do that. Here's how you can check a module's existence: if (outcome != success) of /host=master/core-service=module-loading/:list-resource-loader-paths(module=your.module.name)

Merging 3 separate commands into one that re-encodes a video, extracts a thumbnail, delete original and rename new video in subdirectories

≡放荡痞女 提交于 2019-12-04 05:20:58
问题 I am trying to execute a find bash command to process hundreds of video files that are all named video-original.mp4 but are in subdirectories of a parent directory. Here's an example of the directory structure: videos ├── 01a │ └── video-original.mp4 ├── 01b │ └── video-original.mp4 ├── 02a │ └── video-original.mp4 ├── 02b │ └── video-original.mp4 ├── 03a │ └── video-original.mp4 └── 03b └── video-original.mp4 I am using the following command: find ./ -name 'video-original.mp4' -exec bash -c

How to check if there is a there is a wget instance running

余生颓废 提交于 2019-12-04 05:20:21
问题 I have this php script that will run wget's fork processes each time this is called with the & : wget http://myurl?id='.$insert_id .' -O ./images/'. $insert_id.' > /dev/null 2>&1 & But how I can check if there is already a wget proces in progress and if there is one, don't run another one ? 回答1: This code is used to control running process (which in my case is php script). Feel free to take out parts that you need and use them as you please. class Process { private $processName; private $pid;

Xdebug laravel artisan commands

末鹿安然 提交于 2019-12-04 05:06:23
I regularly use xdebug to debug applications, I've built a laravel application that takes an upload of a csv inserts the data to the database and the ids to a job queue. I've written an artisan command to be run via cron to then do something with this data. Xdebug works for accessing the site via the browser, but its not breaking on breakpoints when ran from cli. I run php5-fpm. My files /etc/php5/fpm/php.ini and /etc/php5/cli/php/ini both contain the following settings: zend_extension=/usr/lib/php5/20121212/xdebug.so xdebug.remote_enable = 1 xdebug.idekey = 'dev_docker' xdebug.remote

Python Curses without clearing screen

穿精又带淫゛_ 提交于 2019-12-04 05:01:09
This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 5 years ago . Learn more . I would like to use Curses under Python without clearing the screen. The reason is that I would like my app to pop up a simple small menu over the existing screen and soon exit. It is acceptable, though not preferred, to leave the ugly pieces of the pop up menu on the screen upon exit. The idea is to use it for quick practical sysadmin apps and scripts where aesthetics is not important. It seems that the Python init functions always clear the