Commit Graph

6 Commits

Author SHA1 Message Date
appleboy b02263adb0 refactor: improve code quality and efficiency in various files (#548)
- Replace loadConfig() with _ = loadConfig()
- Update file permissions from 0660 to 0o660
- Simplify variable declarations
- Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term
- Remove unused getCertPrincipals function
- Replace time.Now().Sub() with time.Since()
- Add test for ArgToIndex function

Signed-off-by: appleboy <appleboy.tw@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/548
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2023-04-30 11:43:26 +08:00
Norwin bbb287e29e markdown: dont emit ansi sequences when not emitting to tty (#491)
Allows generating a plain text version of an issue (i.e. without colors and other terminal formatting) when storing stdout in a file.
```
tea issue --comments 1 > issue1.txt
```

`IsInteractive()` had to be moved to avoid a recursive import chain.

---

In the future, it would be nice to also respect the `--output` flag. This flag is currently designed for tabular output, but we could add more supported values like `markdown` `ansi`, `plain` to it

Co-authored-by: Norwin <git@nroo.de>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/491
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: delvh <dev.lh@web.de>
2022-09-14 02:35:15 +08:00
Norwin b8dbf899d2 Update dependencies (#501)
- The go-sdk update fixes #463

- To review the other updates:
  - glamour [changelog](https://github.com/charmbracelet/glamour/releases), [diff](https://github.com/charmbracelet/glamour/compare/v0.3.0...v0.5.0)
    - enhancement: we now can use `WithPreservedNewLines()` to render markdow the same way as the web ui
  - termenv [changelog](https://github.com/muesli/termenv/releases), [diff](https://github.com/muesli/termenv/compare/v0.9.0...v0.12.0)
    - enhancement: correct feature detection for more terminals
  - xdg [changelog](https://github.com/adrg/xdg/releases), [diff](https://github.com/adrg/xdg/compare/v0.3.3...v0.4.0)
    - no notable changes for us, but good to stay up to date 🤷
  - survey [changelog](https://github.com/AlecAivazis/survey/releases), [diff](https://github.com/AlecAivazis/survey/compare/v2.3.1...v2.3.6)
    - bugfixes
  - cli [changelog](https://github.com/urfave/cli/releases), [diff](https://github.com/urfave/cli/compare/v2.3.0...v2.16.3)
    - bugfixes?

Co-authored-by: Norwin <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/501
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Norwin <noerw@noreply.gitea.io>
Co-committed-by: Norwin <noerw@noreply.gitea.io>
2022-09-14 01:52:44 +08:00
Norwin 222d0501df Detect markdown line width, resolve relative URLs (#332)
~~this is semi-blocked by https://github.com/charmbracelet/glamour/pull/96, but behaviour isn't really worse than the previous behaviour (most links work, some are still broken)~~

#### testcase for link resolver
```
tea pr 332
tea checkout 332 && make install && tea pr 332
```

- [rel](./332)
- [abs](/gitea/tea/pulls/332)
- [full](https://gitea.com/gitea/tea/pulls/332)

Co-authored-by: Norwin Roosen <git@nroo.de>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/332
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Norwin <noerw@noreply.gitea.io>
Co-committed-by: Norwin <noerw@noreply.gitea.io>
2021-03-12 20:28:46 +08:00
6543 5cb3e1ded5 Refactor: Move list print functions into print package (#273)
MV list issues -> print.IssuesList

MV list labels -> print.LabelsList & task.LabelsExport

MV list logins -> print.LoginsList

MV list miles -> print.MilestonesList

MV list pulls -> print.PullsList

MV list releases -> print.ReleasesList

MV list issues&pulls of mile -> print.IssuesPullsList

MV list notification threads -> print.NotificationsList

Unexport print.outputList

Unexport print.outputMarkdown

remove comd/flags dependency in print module

Reviewed-on: https://gitea.com/gitea/tea/pulls/273
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: Andrew Thornton <art27@cantab.net>
Co-Authored-By: 6543 <6543@obermui.de>
Co-Committed-By: 6543 <6543@obermui.de>
2020-12-08 18:28:54 +08:00
Norwin 30c3aa4f5b Handle Invalid Markdown (#218)
markdown: use builtin dark/light theme detection

handle invalid markdown

Co-authored-by: Norwin Roosen <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/218
Reviewed-by: 6543 <6543@noreply.gitea.io>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
2020-10-05 02:23:57 +00:00