erlef / rebar3_hex

Rebar3 Hex library
Apache License 2.0
101 stars 49 forks source link

Make r switch mandatory when non-default repos are detected for state changing ops #114

Closed starbelly closed 5 years ago

starbelly commented 5 years ago

This PR aims to provide a consistent API when deciding what commands require a repo argument and more specifically when.

Things in this PR not directly related to the above:

- move search result functions back into rebar3_hex_search, they never belonged in the utils module.
- added maybe_throws/2 helper on utils module for handling function that maybe throw (specifically for breaking out of recursive functions). 

To recap on the API part here are the rules for when a repo argument is required going forward:

Cut

Docs

Key

Owner

Publish

Repo

Retire

Revert

User

Search

tsloughter commented 5 years ago

Yes, it should be required for cut as well.

starbelly commented 5 years ago

Ok, got some feedback from Fred... so, what we can do is require a repo name for all hex ops that require a repo when non-defaults exist. So, in the case of not having any non-default configs, we just publish (i.e., no repo name is required). If non-default configs are found and no name was provided, bail.

Sound good?

tsloughter commented 5 years ago

yup

starbelly commented 5 years ago

@tsloughter hmm, look at the latest changes. We will require supplying the repo for searching... maybe it shouldn't be this way for that... though, a valid read key is indeed required for searching 🤔

We could add an optional param for rebar3_hex_utils:repo/1... use_first where the first repo in config would be used. This creates a problem though if the intention is to allow searching repositories other than hexpm.