Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config file provided before command #458

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

pahatz
Copy link
Contributor

@pahatz pahatz commented Oct 16, 2024

Related issue(s) and PR(s)
This PR closes #442 .

Description
The user should be able to provide the config file location argument ONLY before the subcommand of the cli.

How to test
For test coverage, some of the existing tests have been altered to follow the new allowed order of providing the config, i.e. before the subcommand.
To manually test, one should test individually the cli commands that are affected. Those are the ones that are using the config as an argument(upload, list htsget, download).

@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 30.76923% with 18 lines in your changes missing coverage. Please review.

Project coverage is 39.39%. Comparing base (e4ef2a3) to head (9f0ef6d).

Files with missing lines Patch % Lines
main.go 0.00% 17 Missing ⚠️
download/download.go 66.66% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #458      +/-   ##
==========================================
- Coverage   39.60%   39.39%   -0.22%     
==========================================
  Files          11       11              
  Lines        2030     2036       +6     
==========================================
- Hits          804      802       -2     
- Misses       1109     1117       +8     
  Partials      117      117              
Flag Coverage Δ
unittests 39.39% <30.76%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pahatz pahatz self-assigned this Oct 21, 2024
@pahatz pahatz marked this pull request as ready for review October 21, 2024 14:13
Copy link
Contributor

@jbygdell jbygdell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shuld be no IFs here, the config must be set before any action i.e. sda-cli -config cli.conf ACTION -FLAGS should be the only functioning command.

Config can be as a file or as ENV flags.

Usage for all commands needs to be updated to match the new setup.

Copy link
Member

@MalinAhlberg MalinAhlberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, @pahatz! Works well as far as I can tell!
I agree that it is a bit confusing that you can provide two configs, though... unless there's a use case I'm missing, it's probably cleaner to only allow one.

The README also needs some updates (apart from the Usage sections in the go files, that Jocke mentioned).

@pahatz
Copy link
Contributor Author

pahatz commented Oct 22, 2024

I changed the behavior to work only for the config to be provided before the command.
Updated the tests, readme and Usage references.

@pahatz pahatz force-pushed the feature/config-before-command branch 2 times, most recently from cdf06cf to 14cbb58 Compare October 22, 2024 11:29
@pahatz pahatz force-pushed the feature/config-before-command branch from 14cbb58 to 072234b Compare October 22, 2024 11:35
@pahatz pahatz changed the title config can be provided before command config file provided before command Oct 22, 2024
upload/upload.go Outdated Show resolved Hide resolved
upload/upload.go Outdated Show resolved Hide resolved
upload/upload.go Outdated Show resolved Hide resolved
@pahatz pahatz force-pushed the feature/config-before-command branch from 1d3f898 to 4b57b91 Compare October 23, 2024 07:59
htsget/htsget_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@nanjiangshu nanjiangshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just added a comment regarding path concatenation, otherwise, it looks great!

Copy link
Contributor

@nanjiangshu nanjiangshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. It's weird that the integration test failed even after I reran it. Maybe a rebase to the main will fix the problem.

@pahatz
Copy link
Contributor Author

pahatz commented Oct 28, 2024

Looks good to me. It's weird that the integration test failed even after I reran it. Maybe a rebase to the main will fix the problem.

v0.3.159 appears as the latest tag but the related sda images are missing.

@jbygdell
Copy link
Contributor

Looks good to me. It's weird that the integration test failed even after I reran it. Maybe a rebase to the main will fix the problem.

v0.3.159 appears as the latest tag but the related sda images are missing.

v0.3.158 is the latest released version

main.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[session] Config file should be an option for the base command
5 participants