Logo Search packages:      
Sourcecode: tahoe-lafs version File versions  Download package

fuse::FuseOptParse Class Reference

List of all members.

Detailed Description

This class alters / enhances `SubbedOptParse` so that it's
suitable for usage with FUSE.

- When adding options, you can use the `mountopt` pseudo-attribute which
  is equivalent with adding a subopt for option ``-o``
  (it doesn't require an option argument).

- FUSE compatible help and version printing.

- Error and exit callbacks are relaxed. In case of FUSE, the command
  line is to be treated as a DSL [#]_. You don't wanna this module to
  force an exit on you just because you hit a DSL syntax error.

- Built-in support for conventional FUSE options (``-d``, ``-f`, ``-s``).
  The way of this can be tuned by keyword arguments, see below.

.. [#] http://en.wikipedia.org/wiki/Domain-specific_programming_language

Keyword arguments for initialization

  Boolean [default is `True`].
  Enables support for the usual interpretation of the ``-d``, ``-f``

  Boolean [default is `True`].
  If it's True, then the last (non-option) argument
  (if there is such a thing) will be used as the FUSE mountpoint.

  String: ``whine``, ``undef``, or ``setsingle`` [default is ``whine``].
  The ``-s`` option -- traditionally for asking for single-threadedness --
  is an oddball: single/multi threadedness of a fuse-py fs doesn't depend
  on the FUSE command line, we have direct control over it.

  Therefore we have two conflicting principles:

  - *Orthogonality*: option parsing shouldn't affect the backing `Fuse`
    instance directly, only via its `fuse_args` attribute.

  - *POLS*: behave like other FUSE based fs-es do. The stock FUSE help
    makes mention of ``-s`` as a single-threadedness setter.

  So, if we follow POLS and implement a conventional ``-s`` option, then
  we have to go beyond the `fuse_args` attribute and set the respective
  Fuse attribute directly, hence violating orthogonality.

  We let the fs authors make their choice: ``dash_s_do=undef`` leaves this
  option unhandled, and the fs author can add a handler as she desires.
  ``dash_s_do=setsingle`` enables the traditional behaviour.

  Using ``dash_s_do=setsingle`` is not problematic at all, but we want fs
  authors be aware of the particularity of ``-s``, therefore the default is
  the ``dash_s_do=whine`` setting which raises an exception for ``-s`` and
  suggests the user to read this documentation.

  Argument should be a SubbedOpt instance (created with
  ``action="store_hive"`` if you want it to be useful).
  This lets you customize the handler of the ``-o`` option. For example,
  you can alter or suppress the generic ``-o`` entry in help output.

Definition at line 181 of file fuse.py.

Public Member Functions

def __init__
def add_option
def error
def exit
def parse_args
def print_help
def print_version

Public Attributes


The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index