Skip to content

Commit ce491ef

Browse files
committed
Add --plain flag for jn mv
1 parent e20a7b0 commit ce491ef

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ provided for you.
239239
i.e. If you rename a note from `2026-01-01-important.md` to `urgent` it will be
240240
saved as `2026-01-01-urgent.md`.
241241

242+
You can also pass the `--plain` flag to `jn mv` and it will do no clever
243+
prefix/extension magic and instead, just rename the file to what you want
244+
whilst still preserving the directory it's in.
245+
246+
The complete command is:
247+
248+
```
249+
jn mv --plain
250+
```
242251

243252
### Creating a book
244253

src/jn.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ for kind, key, val in getopt():
6161
quit()
6262

6363
if key in mv.aliases:
64-
mv.process(configuration)
64+
mv.process(configuration, params)
6565
quit()
6666

6767
if key in grep.aliases:

src/subcommands/mv.nim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ../console
99

1010
const aliases* = @["mv", "move"]
1111

12-
proc process*(config: Config) =
12+
proc process*(config: Config, flags: seq[string]) =
1313
var choice = selectFromDir(
1414
getNotesPath(config),
1515
config
@@ -32,7 +32,11 @@ proc process*(config: Config) =
3232
let suffix = getNotesSuffix(config)
3333
let dateFormat = getNotesPrefix(config)
3434
let prefix = now().format(dateFormat)
35-
let fileName = prefix & "-" & newName.replace(" ", "-") & suffix
35+
36+
var fileName = prefix & "-" & newName.replace(" ", "-") & suffix
37+
38+
if "--plain" in flags:
39+
fileName = newName
3640

3741
let oldPath = choice
3842
let dirPath = parentDir(oldPath)

0 commit comments

Comments
 (0)