def show(ctx, entry_id, color, html, raw, width, alignment, image_links): """ Show the text of an entry. The ENTRY_ID can be found with `list` command. """ params = ShowCommandParams(entry_id, color, html, raw, image_links) params.width = width params.align = Alignment.get(alignment) run_command(ShowCommand(ctx.obj, params))
def test_alignment(self, monkeypatch, values): def request(self): return Response( 200, '{"id": 1, "title": "title", "content": "content",\ "url": "url", "is_archived": 0, "is_starred": 1}') monkeypatch.setattr(GetEntry, 'request', request) params = ShowCommandParams(1) params.width = values[0] params.align = values[1] result, output = ShowCommand(self.config, params).execute() assert result assert output == (f'{" "*int(values[2])}title\n' f'{" "*int(values[2])}{"="*int(values[3])}\n' f'{" "*int(values[2])}content')