KDE 4.2 PyKDE API Reference

- KDE's Python API

# KCmdLineOptions Class Reference

`from PyKDE4.kdecore import *`

## Detailed Description

Class that holds command line options.

This class is intended to be used with the KCmdLineArgs class, which provides convenient and powerful command line argument parsing and handling functionality.

See also:
  KCmdLineArgs for additional usage information

## Methods

| __init__ (self)
| __init__ (self, KCmdLineOptions options)
KCmdLineOptions | add (self, QByteArray name, KLocalizedString description=KLocalizedString(), QByteArray defaultValue=QByteArray())
KCmdLineOptions | add (self, KCmdLineOptions options)

## Method Documentation

__init__ | ( |  | self ) |

Constructor.

__init__ | ( | self, |
|  | KCmdLineOptions | options
| ) |  |  |

Copy constructor.

KCmdLineOptions add | ( | self, |
|  | QByteArray | name,
|  | KLocalizedString | description=KLocalizedString(),
|  | QByteArray | defaultValue=QByteArray()
| ) |  |  |

Add command line option, by providing its name, description, and possibly a default value. These will print out when <i>myapp --help</i> is called on the command line.

Note that if the option name begins with "no" that you will need to test for the name without the "no" and the result will be the inverse of what is specified. i.e. if "nofoo" is the name of the option and <i>myapp --nofoo</i> is called:

     KCmdLineArgs.parsedArgs()->isSet("foo"); // false

Parameters:

  | name | option name
  | description | option description, made available for translation; can be left off
  | defaultValue | default option value, when the value is not specified on the command line; can be left off

KCmdLineOptions add | ( | self, |
|  | KCmdLineOptions | options
| ) |  |  |

Add all options from another KCmdLineOptions object.

Parameters:

  | options | options to add