feat: add --plain option to the show command in order to render notes as plaintext
This commit is contained in:
parent
fc81531f3c
commit
af9a6d82f4
14 changed files with 318 additions and 473 deletions
|
|
@ -49,7 +49,7 @@ def unencrypted_notes(notebooks_path):
|
|||
return unencrypted_root_path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def notebooks_command(settings: Settings):
|
||||
return NotebooksCommand(max_depth=float("inf"), settings=settings)
|
||||
|
||||
|
|
@ -58,27 +58,27 @@ def notebooks_command(settings: Settings):
|
|||
def current_note(notes, settings, encryptor) -> Path:
|
||||
note_path = settings.notebooks_root_path / f"{utils.now().date()}.age"
|
||||
note_path.touch()
|
||||
data = encryptor.encrypt("foo".encode())
|
||||
data = encryptor.encrypt(b"foo")
|
||||
with note_path.open("wb") as f:
|
||||
f.write(data)
|
||||
return note_path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def current_daily(notes, settings, encryptor) -> Path:
|
||||
note_path = (
|
||||
settings.notebooks_root_path / "Work" / "Dailies" / f"{utils.now().date()}.age"
|
||||
)
|
||||
data = encryptor.encrypt("foo".encode())
|
||||
data = encryptor.encrypt(b"foo")
|
||||
with note_path.open("wb") as f:
|
||||
f.write(data)
|
||||
return note_path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def mock_edit(mocker):
|
||||
def edit(callargs: list):
|
||||
with open(callargs[1], "wb") as f:
|
||||
f.write("edited".encode())
|
||||
f.write(b"edited")
|
||||
|
||||
mocker.patch("halig.commands.edit.subprocess.call", side_effect=edit)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue