feat: add --plain option to the show command in order to render notes as plaintext

This commit is contained in:
cătălin 2023-11-28 13:49:13 +01:00
commit af9a6d82f4
Signed by: catalin
GPG key ID: 686088EF78EE4083
14 changed files with 318 additions and 473 deletions

View file

@ -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)