diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2011-02-07 15:33:05 +1300 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2011-02-07 15:33:05 +1300 |
commit | 0bc4095b53ae6a3c150c3262fe44c74301d2241a (patch) | |
tree | 9d14a595b5bb577bf3d43fb51bf198c76c4e3fe1 | |
parent | 067f10aeafbafe8f94dfe0401db4f463c126668a (diff) | |
download | asciidoc-0bc4095b53ae6a3c150c3262fe44c74301d2241a.tar.gz |
Added FILTERS_DIR option to --filters remove command.
-rwxr-xr-x | asciidoc.py | 14 | ||||
-rw-r--r-- | doc/asciidoc.1.txt | 18 |
2 files changed, 20 insertions, 12 deletions
diff --git a/asciidoc.py b/asciidoc.py index 58a4f4a..0b69bf4 100755 --- a/asciidoc.py +++ b/asciidoc.py @@ -5431,16 +5431,22 @@ class Filter: """ Delete filter from .asciidoc/filters/ in user's home directory. args[0] is filter name. + args[1] is optional filters directory. """ - if len(args) != 1: + if len(args) not in (1,2): die('invalid number of arguments: --filter remove %s' % ' '.join(args)) filter_name = args[0] if not re.match(r'^\w+$',filter_name): die('illegal filter name: %s' % filter_name) - d = Filter.get_filters_dir() - if not d: - die('user directory is not defined') + if len(args) == 2: + d = args[1] + if not os.path.isdir(d): + die('directory not found: %s' % d) + else: + d = Filter.get_filters_dir() + if not d: + die('user directory is not defined') filter_dir = os.path.join(d, filter_name) if not os.path.isdir(filter_dir): die('cannot find filter: %s' % filter_dir) diff --git a/doc/asciidoc.1.txt b/doc/asciidoc.1.txt index c989888..e4978ee 100644 --- a/doc/asciidoc.1.txt +++ b/doc/asciidoc.1.txt @@ -102,7 +102,7 @@ The *--filter* option is used to manage AsciiDoc filters. Filter command syntax:
asciidoc --filter install ZIP_FILE [FILTERS_DIR]
- asciidoc --filter remove FILTER_NAME
+ asciidoc --filter remove FILTER_NAME [FILTERS_DIR]
asciidoc --filter list
Where:
@@ -116,9 +116,11 @@ Where: filter name e.g. `my_filter-1.0.zip` packages filter `my_filter`.
*FILTERS_DIR*::
- Filters are installed into a same-named subdirectory of the
- *FILTERS_DIR* directory (*FILTERS_DIR* defaults to the
- `.asciidoc/filters` directory in the user's home directory).
+ The directory containing installed filters. Each filter is contained
+ in its own separate subdirectory which has the same name as the
+ filter.
+ *FILTERS_DIR* defaults to the `.asciidoc/filters` directory in the
+ user's home directory.
The filter commands perform as follows:
@@ -127,12 +129,12 @@ The filter commands perform as follows: filter then extract the *ZIP_FILE* into it.
*remove*::
- Delete the *FILTER_NAME* filter directory and all its contents from
- the `.asciidoc/filters` directory in the user's home directory.
+ Delete the *FILTER_NAME* filter subdirectory and all its contents from
+ the *FILTERS_DIR*.
*list*::
- List the names of all installed filters (including standard filters
- installed in the global configuration directory).
+ List the names and locations of all installed filters (including
+ standard filters installed in the global configuration directory).
EXIT STATUS
|