You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MANUAL.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,13 +117,22 @@ The output of this command will list all available tag names sorted by name and
117
117
118
118
119
119
# Modes of operation
120
-
`tempren` have two main modes of operation: **name** and **path**.
120
+
`tempren` have three main modes of operation: **name**, **directory** and **path**.
121
121
122
122
In the (default) **name** mode (represented by `--name`/`-n` flag), the template is used for filename generation only.
123
123
This mode is used most often as it doesn't alter directory structure and focuses just on the files. In this mode, if a path separator (i.e. `/`) is present in the generated path, an error will be reported.
124
124
125
125
Name mode is used mostly when operating on a single directory or files specified directly in the command-line arguments.
126
126
127
+
Similarly, with **directory** mode selected (by `--directory`/`-d` flag), template generates new names for directories only - without changing filesystem hierarchy.
128
+
129
+
> Note: In directory mode only contextual and directory-enabled tags are available
130
+
<!--
131
+
TODO: `--directory --list` flags combination (in that order) can be used to list supported tags.
132
+
-->
133
+
134
+
> Note: Currently sorting is not available in the directory mode
135
+
127
136
In the **path** mode (enabled by `--path`/`-p` flag), for each processed file, the template generates a whole, new path (relative to the input directory).
128
137
This way you can move (sort) files into dynamically generated catalogues.
129
138
@@ -340,7 +349,7 @@ To create an ad-hoc tag, you will need to provide an executable path as an argum
340
349
tempren --ad-hoc awk --help awk
341
350
```
342
351
343
-
> Note: When executing the ad-hoc tags, even with `--dry-run`/`-d` flag, `tempren` doesn't have control of the behaviour of the invoked executables.
352
+
> Note: When executing the ad-hoc tags, even with `--dry-run`/`-dr` flag, `tempren` doesn't have control of the behaviour of the invoked executables.
344
353
> Care should be taken to make sure that the user-provided program doesn't create any undesirable side effects upon template execution.
345
354
346
355
There are two ways in which an executable associated with an ad-hoc tag can be invoked.
@@ -373,7 +382,7 @@ Program arguments can be passed in the ad-hoc tag arguments but care should be t
373
382
separate them correctly as spaces do not delimit the arguments like in the shell environment.
374
383
For example, to pass two parameters to the ad-hoc `Program`, the following syntax should be used:
375
384
```
376
-
%Program("--flag-parameter", "positional")
385
+
%Program("--flag", "flag-argument")
377
386
```
378
387
379
388
# Tag aliases
@@ -387,7 +396,7 @@ Tags created from the aliases cannot receive any arguments or context - they are
387
396
388
397
# Various options
389
398
## Dry run
390
-
To facilitate discovery-based usage learning, `tempren`'s `--dry-run`/`-d` flag can be used to disable the actual file renaming stage of the pipeline. This way, users can test their templates without making changes to the filesystem.
399
+
To facilitate discovery-based usage learning, `tempren`'s `--dry-run`/`-dr` flag can be used to disable the actual file renaming stage of the pipeline. This way, users can test their templates without making changes to the filesystem.
391
400
> Note: While dry-run is active, side effects from filtering/sorting template expressions (which are valid Python code), ad-hoc tags
392
401
> or even tags themselves may still affect the file system.\
393
402
> Be careful not to copy-paste templates that look suspicious.
0 commit comments