command-line-arguments

What's the best way to grab/parse command line arguments passed to a Python script?

The title says it all...what's the easiest, tersest, and most flexible method or library for parsing Python command line arguments? ...

Is there a good command line argument parser for Java?

Is there a good options parser framework/library for command-line programs written in Java? E.g. the equivalent of Python's optparse? ...

How to load program reading stdin and taking parameters in gdb?

I have a program that takes input from stdin and also takes some parameters from command line. It looks like this: cat input.txt > myprogram -path "/home/user/work" I try to debug the code with gdb inside emacs, by M-x gdb, I try to load the program with the command: gdb cat input.txt > myprogram -path "/hom...

How can I process command line arguments in Python?

What would be an easy expression to process command line arguments if I'm expecting anything like 001 or 999 (let's limit expectations to 001...999 range for this time), and few other arguments passed, and would like to ignore any unexpected? I understand if for example I need to find out if "debug" was passed among parameters it'll be ...

How do I format positional argument help using Python's optparse?

As mentioned in the docs the optparse.OptionParser uses an IndentedHelpFormatter to output the formatted option help, for which which I found some API documentation. I want to display a similarly formatted help text for the required, positional arguments in the usage text. Is there an adapter or a simple usage pattern that can be used f...

Why won't my console app work with 25 arguments or more?

I am making a console application where I drop files onto the .exe from Explorer and it will move them to the appropriate folder based on rules I have set in the logic of the program. The program works great, but when I select more than 25 files and drop them on my .exe I get an error: Windows cannot access the specified device, pat...

Command Line Arguments In Python

I am originally a C programmer. I have seen numerous tricks and "hacks" to read many different arguments. What are some of the ways Python programmers can do this? Related What’s the best way to grab/parse command line arguments passed to a Python script? Implementing a “[command] [action] [parameter]” style command-line interfaces?...

In Java, is there a way to obtain the command line parameters even if main() didn't save them?

We have a program with a main() that parses certain CLPs but does not save them anywhere. I then have my own plug-in code that needs access to the original CLPs (so I can transmit more parameters) for it. However, I cannot change main() I saw that there is apparently a way to do this in C#, I'm looking for an equivalent Java solution o...

Should flags in POSIX-style operating systems be prefixed by "no" or "no_"?

When you have a boolean option and a flag for setting it to false by prefixing "no" to the name, should it be "no" or "no_"? What's most commonly used or better style? For example: --no_foo or --nofoo ...

Should command line options in POSIX-style operating systems be underscore style?

Should the name of command line options for a program in a POSIX-style operating system be underscore-style, like --cure_world_hunger or maybe some other style? --cureworldhunger --cure-world-hunger --cureWorldHunger What's most common? What's better style? What's more Bash-friendly (if such a thing exist)? ...

How do I use the -e option in PHP?

php on the command line tells me that it has an option: -e Generate extended information for debugger/profiler However by running my command line script with that I see nothing... what's that option for? ...

Xcode & passing command line arguments

I just started working with C & Xcode and I've run into a little difficulty. All I want to do is read a file from the command line and see the output in the terminal. I think my problem lies with the path to the file that I want to read in. I'm using a Mac and the file is on my desktop, so the path should be Users/myName/Desktop/words.t...

Reading command line arguments after '<' in C

Let me start by saying this is associated with a homework assignment. However, this is a very small and relatively insignificant part of the assignment. The C program receives input via command line arguments but it needs to be in the form: $ ./program < input How, would I go about receiving that input as a string? Each time I try t...

How to get the nth positional argument in bash?

How to get the nth positional argument in bash? Thanks. Edit: I forgot to say but I meant that n is a variable. ...

What is the Perlish way to iterate from item n to the end of an array?

The problem is that I have n command-line arguments. There are always going to be at least 2, however the maximum number is unbounded. The first argument specifies a mode of operation and the second is a file to process. The 3rd through nth are the things to do to the file (which might be none, since the user might just want to clean the...

Nose test script with command line arguments.

I would like to be able to run a nose test script which accepts command line arguments. For example, something along the lines: test.py import nose, sys def test(): # do something with the command line arguments print sys.argv if __name__ == '__main__': nose.runmodule() However, whenever I run this with a command line a...

Is it possible to use a Unicode "argv"?

Hi, I'm writing a little wrapper for an application that uses files as arguments. The wrapper needs to be in Unicode, so I'm using wchar_t for the characters and strings I have. Now I find myself in a problem, I need to have the arguments of the program in a array of wchar_t's and in a wchar_t string. Is it possible? I'm defining the m...

Forwarding command line arguments to a process in Python

I'm using a crude IDE (Microchip MPLAB) with C30 toolchain on Windows XP. The C compiler has a very noisy output that I'm unable to control, and it's very hard to spot actual warnings and errors in output window. I want to write a python script that would receive arguments for compiler, call the compiler with same arguments, filter resu...

Initializing program with files passed as main arguments (system.getProperty())

Hello, I have to execute my program with this line: java -DImport=data.txt -Din=input.dat -Dout=output1.dat main.Main I've been trying to figure it out how to do this but can't really get it working. I'm using Netbeans since I dont really get along with unix terminal classpaths and so on. public static void main(String[] args) { ...

MS Access Command Line Args Not Working In Virtual PC

My associate is using Win 7 Pro 64bit, and running an MS Access 2003 application in a Virtual PC (setup as Win XP). It appears that the Access command line arguments are being ignored: both /cmd [myString], and /decompile. Although not a crucial problem, has anyone else come across this - or other MS Access probs whilst running in VPC?...