Comments (6)
I think a has_required_flag
member makes a lot of sense for this situation. Sounds look a good clean solution!
from emplace.
It might make more sense to have a hook which is given the entire command line and is able to reject it - then the hook would be usable for other special cases where a declarative approach is a lot of effort
from emplace.
Hi @jayvdb, unfortunately I'm not maintaining this application anymore, so I won't pick up this issue. Any PR's are greatly appreciated though!
from emplace.
I am happy to build the fix for this.
I've had a poke around, and notice the problem of local project package installs is unique to npm
. All others are either global/system or per-user installs. Also none of the open issues are proposing another package manager which would have the same problem.
A quick fix is to change npm
to be similar to rustup
which has a sub_commands
of "component add"
.
i.e. sub_commands
for npm could be install -g
and install --global
. However that would not catch npm install foo -g
/ npm install foo --global
.
To properly solve his without regressions, IMO the package managers need a member has_required_flag
or similar, which for npm
would return -g
and --global
. This feels a bit like overkill because there is no other package manager which currently needs this. Maybe I have missed a better alternative.
from emplace.
Digging a little deeper, I wonder if it would be OK to add a CaptureFlag::Invalidating("--path")
to cargo.rs
to replace has_invalidating_flag
, and CaptureFlag::Required(["-g", "--global"])
to npm.rs
which would tell catch
that the line should be ignored unless it was found.
Invalidating
is easy as it presence in the command args could be handled in handle_capture_flags
, which could return a bool
to tell capture
to ignore the line. Multiple Invalidating
would be OR'd.
Required
is slightly more involved, as capture
would need to see if Required
is present in the package managers capture_flags()
return value before processing the command args, and verified that it was seen. Required
would take a vec of equivalent flags that are OR'd (e.g. "-g" or "--global" are required), and multiple Required
would be AND'd.
This approach would mean that flag processing is still declarative, but doesn't involve creating new members like has_required_flag
that are unnecessary for most package managers.
from emplace.
This sounds like a good solution! I think this would make the implementation a lot cleaner.
from emplace.
Related Issues (20)
- [FEATURE] Capture uninstall comands
- [FEATURE] Capture package manager sources
- [BUG] Silent fails if other commits are added to the repo
- [FEATURE] Support for package manager pipx
- [FEATURE] Support for port package manager
- [FEATURE] Support for Flatpak
- [BUG] Compilation failure HOT 4
- [BUG] Fail to compile HOT 1
- failed to `cargo install emplace` HOT 3
- [BUG] Install failure wrt usage of clap HOT 2
- Dependency Dashboard
- [BUG] Support "go install"
- [BUG] CLI parser should ignore $(..)
- [FEATURE] Support for cargo-quickinstall
- [FEATURE] Support for `cargo-binstall` HOT 5
- [BUG] Compilation errors with Rust 1.69.0 HOT 3
- [BUG] ZSH warning/error with `eval "$(emplace init zsh)"`
- [BUG] fails to build on android termux HOT 6
- [BUG] cannot change location of configuration and repository files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emplace.