Commit Graph

9 Commits (b868d304348198167b7678c6980207a4abe7718f)

Author SHA1 Message Date
techknowlogick b868d30434 spdx (#581)
Co-authored-by: techknowlogick <hello@techknowlogick.com>
Co-committed-by: techknowlogick <hello@techknowlogick.com>
9 months ago
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>
1 year ago
Norwin 6663d9f19b Add preference `flag_defaults.remote`, refactor (#466)
This is a refactor of the code last touched in #458, making the control flow less backwards.

Additionally, this adds a preference `preferences.flag_defaults.remote` that allows to skip this heuristic and set a custom fixed default value for the `--remote` flag.
I'm not sure this is actually needed, I can revert that commit.

Co-authored-by: Norwin <git@nroo.de>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Reviewed-on: https://gitea.com/gitea/tea/pulls/466
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>
2 years ago
Norwin 78a95f1ca4 Allow editing multiline prompts with external text editor (#429)
- Adds a new `Preferences` struct to the config, initially only containing `Editor: bool (default false)`.
  This struct will be serialized to configs once there is a first tea induced change to the config (eg `tea login default <name>` or `tea login add`).
- Use external editor for all multiline prompts if preferred.

We already had a function for starting a texteditor for diff reviews; it does not really make sense to replace it with `survey.Editor`, as there is a big interface mismatch: survey expects strings as inputs, while our diff functions operate on files,

fixes #424

Co-authored-by: Norwin <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/429
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Norwin <noerw@noreply.gitea.io>
Co-committed-by: Norwin <noerw@noreply.gitea.io>
3 years ago
6543 c063329e9a [Refactor] unexport config.Config var & move login tasks to task module (#288)
Unexport generateToken()

move CreateLogin into task

Create func config.SetDefaultLogin()

Unexport loadConfig() & saveConfig

unexport config var

make SetDefaultLogin() case insensitive

update func descriptions

move FindSSHKey to task module

Reviewed-on: https://gitea.com/gitea/tea/pulls/288
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
Co-Authored-By: 6543 <6543@obermui.de>
Co-Committed-By: 6543 <6543@obermui.de>
4 years ago
Norwin 7e191eb18b fix InitCommand() (#285)
split modules/config

login_tasks.go should probably be modules/task/login.go,
but i didn't do that, as it still depends on the global
`Config` variable from the config module, see
https://gitea.com/gitea/tea/issues/158

rework InitCommand()

- make it error tolerant if $PWD is not a git repo (#200)
- don't force default login when repo flag is set (#191)

remove InitCommandLoginOnly()

Merge branch 'master' into issue-200-initcommand

improve docs

Merge branch 'master' into issue-200-initcommand

move config func and config task func to right place

Co-authored-by: Norwin Roosen <git@nroo.de>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/285
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: khmarbaise <khmarbaise@noreply.gitea.io>
Co-Authored-By: Norwin <noerw@noreply.gitea.io>
Co-Committed-By: Norwin <noerw@noreply.gitea.io>
4 years ago
crapStone c4e2db32b5 rewrote config file path search (#219)
added comment to clarify coding choices

added package xdg to vendor folder

rewrote config file path search

Co-authored-by: crapStone <crapstone01@gmail.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/219
Reviewed-by: 6543 <6543@noreply.gitea.io>
Reviewed-by: Norwin <noerw@noreply.gitea.io>
4 years ago
Norwin de5a00e807 Refactor addLoginMain() (#201)
simplify NormalizeURL

drop noisy log line

must have been introduced recently?

dont use PascalCase for default login names

...for readability.

🔥 opinionated commit

create GenerateLoginName()

fixes

fixup! Merge branch 'master' into refactor-loginMain

move GetOwnerAndRepo() to modules/utils/parse.go

Merge branch 'master' into refactor-loginMain

make linter happy

refactor addLoginMain()

Co-authored-by: Norwin Roosen <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/201
Reviewed-by: 6543 <6543@noreply.gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
4 years ago
6543 f445ac7521 Refactor: apply new internal structurs (#206)
fix lint

fix lint

Move print TrackedTimesList to print package

Move AbsPathWithExpansion to utils/path.go

rename module intern to config

Move Subcomands into it's own Packages

Split times subcomands into own sourcefiles

Split repos subcomands into own sourcefiles

Split releases subcomands into own sourcefiles

Split pulls subcomands into own sourcefiles

Split milestones subcomands into own sourcefiles

Split login subcomands into own sourcefiles

Split labels subcomands into own sourcefiles

split issues subcomands into own sourcefiles

mv

Move Interactive Login Creation to interact package

Move Add Login function to intern/login.go

apply from review

lint: add description to exported func

smal nits

Move DetailViews stdout print func to print package

Refactor:
* Move Config & Login routines into intern package
* rename global var in cmd
* Move help func to utils

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/206
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years ago