-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement file management operations and add a demo for them
These are the basic ones for now. `diff`/`patch` will be handled similarly to the `match` mode I think.
- Loading branch information
1 parent
50fe1c7
commit 6892849
Showing
4 changed files
with
90 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
file-name-external.txt | ||
file-name-internal.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# File management | ||
|
||
## Create, replace | ||
|
||
This creates a new file with the below content: | ||
|
||
`file-name-external.txt`: | ||
|
||
``` | ||
Hello, world! (External) | ||
``` | ||
|
||
It can be shortened by specifying the file name inline with the `..` prefix: | ||
|
||
```txt ..file-name-internal.txt | ||
Hello, world! (Internal) | ||
``` | ||
|
||
## Append | ||
|
||
Use the `!` sigil to signify the content code block is to be added to the file | ||
and not replace it altogether: | ||
|
||
`file-name-external.txt`: | ||
|
||
```txt ! | ||
Hello, world! (External again) | ||
``` | ||
|
||
This can be shortened as well by specifying the file name inline but using the | ||
`!!` prefix instead of the `..` one for creation. | ||
|
||
```txt !!file-name-internal.txt | ||
Hello, world! (Internal again) | ||
``` | ||
|
||
## Check | ||
|
||
When needing to highligt a file in its entirety, the match sigil can be used. | ||
It will compare the file's contents on the disk with the code block content and | ||
will error if they do not match. | ||
|
||
`file-name-external.txt`: | ||
|
||
```txt ?? | ||
Hello, world! (External) | ||
Hello, world! (External again) | ||
``` | ||
|
||
```txt ??file-name-internal.txt | ||
Hello, world! (Internal) | ||
Hello, world! (Internal again) | ||
``` | ||
|
||
The prefix to use here is `??`. | ||
|
||
## Move, delete | ||
|
||
Deleting and moving files is relegated to the shell handler, e.g.: | ||
|
||
~~~ | ||
```sh | ||
mv file-name.ext file-name-moved.ext | ||
rm file-name-moved.ext | ||
``` | ||
~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters