Commit Graph

66 Commits

Author SHA1 Message Date
Gary Holtz 7932b105ba
fix: Preventing a panic when not using a sub command 2023-06-28 11:41:23 -05:00
Jay McCure b834f40e4c
fix(check-update): always show error when check-update fails 2023-06-09 18:34:38 +10:00
Gary Holtz 45ac8caaff fix: Change platform generating code 2023-04-12 22:39:49 +00:00
Jay McCure a6d9808b86 Merge branch 'add-debug-variable-makefile' into 'main'
chore: add debug environment variable to Makefile

See merge request https://gitlab.com/gitlab-org/cli/-/merge_requests/1197

Merged-by: Jay McCure <jmccure@gitlab.com>
Approved-by: Jay McCure <jmccure@gitlab.com>
Approved-by: James Liu <jliu@gitlab.com>
Reviewed-by: Jay McCure <jmccure@gitlab.com>
Co-authored-by: Jaime Martinez <jmartinez@gitlab.com>
2023-03-09 05:20:34 +00:00
Jaime Martinez 5afb7aae66 chore: add debug environment variable to Makefile 2023-03-09 05:20:33 +00:00
Gary Holtz a72ecfeda6 chore: remove build date and add architecture 2023-03-09 02:31:35 +00:00
Gary Holtz d71d6fff30 chore: Modify UserAgent to be more like other CLIs 2023-03-08 16:36:03 +00:00
James Liu 5e00cdf125 fix: Read hostname from config.yml 2022-11-07 20:52:56 +00:00
Oscar Tovar 40a5436789 chore: update module path 2022-09-19 20:23:45 +00:00
Clement Sam 40c8f6760e fix(check-update): check latest release from GitLab
Currently the check-update command which checks for
latest glab releases, checks from the releases page
of the old GitHub repo.

This MR changes this behaviour to check releases
from the new gitlab-org/cli repo.
2022-08-10 18:58:23 +00:00
Rob Hoelz 2eba4de79a
Add support for terminal hyperlinks (#852)
* feat: Add ground work for supporting hyperlinks to iostreams

See GH #812

See https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
for technical details behind the hyperlink escape sequence

For now hyperlinks are enabled as long as long as standard output is a
TTY - we'll want to add some additional detection/flags down the road

* feat: use terminal hyperlinks when listing issues/MRs

See GH #812

* feat(hyperlinks): Add display_hyperlinks config option

* chore(hyperlinks): Clean up Hyperlink API a bit

* feat(hyperlinks): default hyperlinks to off

I think hyperlink display should default to off while the feature is new
so that users can play with it

* feat(hyperlinks): Implement FORCE_HYPERLINKS

Setting the FORCE_HYPERLINKS environment variable forces glab to render
hyperlinks when it can - otherwise, it falls back to display_hyperlinks
from the config, which tells glab whether or not to enable hyperlinks
based on whether or not we're outputting to a TTY.

* fix(hyperlink): accommodate hyperlink OSC in string stripping

* fix: Fix incorrect web_url in fixture data

* test(hyperlink): Add tests for hyperlinks in issues list

* test(hyperlink): Add tests for truncating text with hyperlink OSC

* fix(hyperlinks): accommodate hyperlinks in Truncate

* test(hyperlinks): Add tests for showing hyperlinks in mr list

* docs(hyperlink): Add docs for FORCE_HYPERLINKS and display_hyperlinks

* fix(hyperlinks): simplify truncate algorithm

…while also fixing tableprinter tests, which expect that the first
grapheme provided to Truncate is always preserved

* fix(hyperlinks): Deactivate hyperlinks in auto mode if we're writing to a pager
2021-10-27 09:41:35 +00:00
Rob Hoelz 7d0992432b chore: use errors.Is instead of error equality
This might be needlessly pedantic, but it insulates against potential
future changes in error wrapping
2021-10-03 09:49:42 -05:00
addshore b8928008b5 Move glinstance to pkg 2021-09-24 18:51:08 +01:00
Clement Sam f636f0b13e fix test 2021-05-23 03:17:18 +00:00
Clement Sam af5ba63dc6 interactive options and better error handling 2021-05-23 02:51:23 +00:00
Clement Sam e5cf7c3143 scriptability: Avoid truncating columns of tables/lists on non-TTYs
This is a hot fix to solve where glab still truncates lines with length longer that the specified column width on non-TTYs to improve scriptability

Resolves #706
2021-05-12 00:43:54 +00:00
Clement Sam 70ea685827 Allow protocol override when overriding the default host
This allows overriding the default protocol of the hostname if a fully qualified url is provided when using the `GITLAB_HOST` environment variable.
For example, if the GITLAB_HOST=http://my.glinstance.org, then the host will be set to my.glinstance.org and the protocol become http, unlike before when the protocol was ignored and only the hostname was considered.

This is a follow-up for #678
and #667
2021-04-30 06:42:11 +00:00
Alberts Zemzale b520c9c8ac fix(main): Allow host override with full URLs
When trying to override host with full URLs, config key lookups would
fail. This came down to the fact that we use `my.gitlab.com` as config
key and when providing override as `https://my.gitlab.com/` it would
fail to find this config key.

Issue #592
2021-04-28 13:52:08 +03:00
Alberts Zemzale 7e9e9e80c0
fix(main): OverrideDefault using base repo host
When using flags/commands that override the repo, but don't supply
hostname, we allways fallback to `gitlab.com`. This is a problem for
commands like `mr checkout 12 -R OWNER/REPO` that should use API host
`self-hosted`, but actually use `gitlab.com`.

Now we override default host, from the base repo, if one is found.
Environment values still override repo host.
2021-04-08 09:40:00 +03:00
Clement Sam 4c1fef01d8 fix: respect GLAB_PAGER in config and env vars
Resolves #320 Resolves #656
2021-03-15 11:47:28 +00:00
Clement Sam 961b8a3c3a Override survey's choice of color for default values
For default values for e.g.  prompts, Survey uses the literal white color, which makes no sense on dark terminals and is literally invisible on light backgrounds.

This overrides Survey to output a gray color for 256-color terminals and default for basic terminals.
2021-03-10 21:20:43 +00:00
Clement Sam 56bdf53432 fix: avoid printing unnecessary blank newlines
Closes #391
2021-01-05 16:23:07 +00:00
Leo a2efea805a test(cmd/glab/main): test path where debug is active 2021-01-05 04:50:08 -03:00
Clement Sam ff2e936599 fix incorrect version info on check-update
Fixes #282
2020-11-16 16:29:31 +00:00
Clement Sam 7506a8a837 Redesign Tableprinter to adjust content based on terminal size 2020-11-13 12:24:07 +00:00
Clement Sam aea733a6d9 style: reformat version output 2020-11-12 13:14:13 +00:00
Clement Sam de8322f6fc
feat: glab auth login (#277)
* respect NO_PROMPT env var

* feat: glab auth login

* 🧹🔥 api client

* add tests

* linting

* fix tests

* add non-sensitive token for test to work
2020-10-25 11:31:01 +00:00
Clement Sam 74b2d8e189
fix(config): respect api_protocol in config (#275)
* fix(config): respect api_protocol in config

Fixes #270

* fix lint errors
2020-10-21 13:01:04 +00:00
Clement Sam d2b92f9ae7 add pager support to mr list 2020-10-14 20:24:54 +00:00
Clement Sam 53f98c16b5
feat: detect MR for current branch (#264)
* feat: detect MR for current branch

* fix lint errors

* fix error on test

* fix error on test
2020-10-14 15:09:20 +00:00
Clement Sam d71e3d8f89
chore(ci): use golangci action (#256)
* chore(ci): use golangci action

* Update lint.yml

* Update lint.yml

* fix lint chore

* fix lint errors

* fix lint errors

* disable travis buddy to reduce noise
2020-10-07 21:12:12 +00:00
Clement Sam 6c4fe1c2e8
Isolate commands into separate sub-packages (#229)
* refactor: organize commands into separate subfolders

* Format code with gofmt

This commit fixes the style issues introduced in d1f70d5 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/1ce57d1c-4f1e-48c2-a4d8-00c1bce7fb49/

* 🔥 sub-packaging

* Format code with gofmt

This commit fixes the style issues introduced in ca0bff4 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/11379011-98c6-43ea-8baa-4fefa9b775e4/

* 🔥 sub-packaging

* Format code with gofmt

This commit fixes the style issues introduced in 00e5936 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/c912f945-acf3-48d2-a550-0895c0153df0/

* Done with sub-packaging 🔥

* 🔥 tests

* Format code with gofmt

This commit fixes the style issues introduced in 56a8ff4 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/24498865-4980-479f-90c7-7ddd228c2bb4/

* fix bug risks

* fix tests

* fix tests

* Format code with gofmt

This commit fixes the style issues introduced in c947d02 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/cb2ac46a-f857-40d5-8508-eacc253b3614/

* Format code with gofmt

This commit fixes the style issues introduced in 902ff7b according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/f60ba0d6-94d3-47c0-ae27-568a5cc5d9e5/

* fix tests

* fix tests

* 🔥 gookit/color

* Format code with gofmt

This commit fixes the style issues introduced in 5a129ea according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/8f1c8327-f5c6-4ff5-97d2-3c8a23f0a1e2/

* Autofix issues in 1 files

Resolved issues in the following files via DeepSource Autofix:
1. commands/cmdtest/helper.go

* add tests for MR

* Format code with gofmt

This commit fixes the style issues introduced in 758af28 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/d55a4867-aa23-4202-b2cc-a7ceafbaa53e/

* migrate old config to new config

* fix bug risks

* Format code with gofmt

This commit fixes the style issues introduced in 0ea8eb2 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/f90cf664-8396-4b78-814d-3167ce898164/

* refactoring

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-09-29 05:55:34 +00:00
Clement Sam 7734f4761f fix: initialize config 2020-09-20 20:38:41 +00:00
Clement Sam ef3709df72
fix: better config package to enhance test and restructuring (#223)
* fix: better config package

* fix: replace config.getRepo() with git.getRepo

* feat: add ability to set git protocol (#221)

* fix: repo clone requires authentication

Closes #198

* feat: add ability to set git protocol

* Format code with gofmt

This commit fixes the style issues introduced in 73ee693 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/1a6879e9-070f-4a9f-a42c-ae4469dfc95d/

* fix: bug risks

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>

* fix: replace config.getRepo() with git.getRepo

* Format code with gofmt

This commit fixes the style issues introduced in 1c0e597 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/ce823f01-c76a-4927-9730-868dfe3c5012/

* Write aliases to file 🔥

* add local config support

* fix tests 🔨

* Format code with gofmt

This commit fixes the style issues introduced in fb011e3 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/c6f8a52f-9c41-4b6f-a15a-9d77e43ff6b8/

* finalize config package

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-09-20 19:58:37 +00:00
Clement Sam dba5765fca
feat: add ability to set git protocol (#221)
* fix: repo clone requires authentication

Closes #198

* feat: add ability to set git protocol

* Format code with gofmt

This commit fixes the style issues introduced in 73ee693 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/1a6879e9-070f-4a9f-a42c-ae4469dfc95d/

* fix: bug risks

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-09-11 21:21:50 +00:00
Clement Sam b11ed7628c
feat: ability to create shell-executable aliases (#220) 2020-09-11 11:42:51 +00:00
Clement Sam 6c92d3f00d
feat: add ability to create repo from current directory (#218)
* feat: add ability to create repo from current directory

* Format code with gofmt

This commit fixes the style issues introduced in ddaebf3 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/e2c1f40c-cea6-4a3e-80e6-b1c0950aae08/

* fix: add optional bool param to initGitlabClient

* Format code with gofmt

This commit fixes the style issues introduced in 6c800da according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/444cacd9-4a43-4ca2-86d6-995afc398b28/

* fix: bug risks

* test: add createproject tests

* Format code with gofmt

This commit fixes the style issues introduced in b2c9547 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/dc04a902-f082-42be-a507-9dd0a493c138/

* fix: bug risks

* test: make test pass

* Format code with gofmt

This commit fixes the style issues introduced in 4739e9c according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/eafd4a64-1327-4b95-9f27-72510506dc81/

* test: make test pass

* test: make test pass

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-09-11 04:35:33 +00:00
Clement Sam 9630a8be38
test: test expand alias (#216)
* test: test expand alias

* chore(ci): add secure token to run tests on PR

* Format code with gofmt

This commit fixes the style issues introduced in 8d6ee7c according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/9003f4ec-3fa4-4058-966e-b29ca3c02f46/

* fix: travis secure data

* fix: update travis secure env

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-09-08 22:19:04 +00:00
Clement Sam b8e5b6716e
refactor: fix module path (#190)
* refactor: fix module path

Change module path from glab to GitHub path in go.mod.
Tidy go.mod
Fix go imports.

Closes 189

* Format code with gofmt

This commit fixes the style issues introduced in 28e5336 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/398ecee6-d38c-472d-a91b-21de49624c9f/

* fix: unused imported package

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-09-02 12:20:33 +00:00
Clement Sam 29408f32c3
test: commands tests (#173)
* test: commands tests

* Format code with gofmt

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-09-02 11:04:56 +00:00
Clement Sam 65f06d7221
fix: set default url and nickname (#185) 2020-08-31 17:33:27 +00:00
Clement Sam 3ec2810c44 fix: clone project over ssh
Clone a repository using the ssh url
. Add upstream as remote pointing to forked repo's ssh url

enhances #70
2020-08-24 05:48:07 +00:00
Bradley Garrod fa25585d1b
feat: Add aliases for long commands (#113)
* feat(alias): Add help pages

* feat(alias): Add ability to add and list aliases

* feat(alias): Add ability to delete aliases

* refactor: refactor code to fix deepsource errors

* fix(alias): Use global config

* fix(alias): Use fmt to print 'That alias does not exist' instead of log

* feat(alias): Add functionality to execute aliases
2020-08-21 17:29:53 +00:00
deepsource-autofix[bot] c8382263dd
Format code with Go fmt 2020-08-15 12:50:25 +00:00
Clement Sam 09ba1378f4 refactor: enhance error handling 2020-08-15 08:39:03 +00:00
deepsource-autofix[bot] 0b0536297f
Format code with Go fmt 2020-08-10 15:07:11 +00:00
Clement Sam c80df4f4af Fix(version): fixed incorrect version info
Resolves #82
2020-08-10 15:05:03 +00:00
deepsource-autofix[bot] 557e209ace
Format code with Go fmt 2020-08-09 10:01:54 +00:00
Clement Sam 0c56135072 Refactor: Restructure Project with cobra
Fix(crash): #60
Fix(help): #66
Fix(output): ansi style output on windows #54
Fix: #53
2020-08-09 09:58:28 +00:00
Clement Sam fd2891b950 docs: auto-generate docs
Resolves #68
2020-08-08 17:14:55 +00:00