Comments (7)
Ah no, scratch what I just said, the file is read every time... This is somewhat inconsistent with the way the documentation of the option is worded.
I think I'll work on a fix specifically for that before fixing the current issue by making sure said option also controls the reading and parsing of the file: when the option is given, it is only used to display "Updating" instead of "Installing" in the logs when the package is already installed, therefore not that useful; I can definitely live without that small display distinction as the option was originally kind of meant for going back to the previous, simpler behavior and thus working around potential future bugs -- this is one of them.
from cargo-liner.
Thank you @PaulDance !
from cargo-liner.
Hi @neslinesli93! Thanks for the report.
As this is controlled by an official configuration element of Cargo, this is indeed a legitimate use case. Just out of curiosity, which one are you actually using: $CARGO_INSTALL_ROOT
or (inclusively) install.root
?
I've looked a bit into how I would solve this:
- Reading
$CARGO_INSTALL_ROOT
is trivial. - Parsing the Cargo config file manually seems tedious, as there are a lot of tables. It should be possible to ignore other tables and just get to
install.root
though. cargo-config2
exists just for that, but it does not expose access to theinstall
table.- There is a currently-unstable official Cargo command that is similar:
cargo config
. Using it would therefore mean either requiring a nightly toolchain to be used throughcargo +nightly liner [...]
(I think), or internally calling Cargo withRUSTC_BOOTSTRAP=1
set (bit of a hack). It handles environment variables as well: runningRUSTC_BOOTSTRAP=1 CARGO_INSTALL_ROOT=/tmp cargo -Z unstable-options config get --format json-value install.root
successfully displays"/tmp"
and havinginstall.root
set in$CARGO_HOME/config.toml
or any.cargo/config.toml
(in)directly under the current directory works too, while preserving the preference over$CARGO_INSTALL_ROOT
.
For now, I think the last option is the best as it supports all possible use cases of these configuration elements and is by far the simplest. Do you know of any other way to change where .crates.toml
is stored? I've searched briefly in the Cargo documentation, but it seems to be mentioned only for install.root
.
Cheers,
Paul.
from cargo-liner.
Thanks for the super quick response! Right now I'm using the env variable, $CARGO_INSTALL_ROOT
. And I agree that the last solution would be the best one, but requiring the nightly toolchain seems a bit too opinionated/wrong, but I don't know...
Did you try all the possibilities described here to see if .crates.toml
is created over there as well?
from cargo-liner.
No problem 😃
Yes, for now, I think I'll try it with RUSTC_BOOTSTRAP=1
first because it simply seems to work just fine and it is only for reading one file anyway. There might be bit of breakage in the future however, we'll have to see.
In the docs you linked, there is a precedence list for the determination of the installation root directory. As of now, only the last two possibilities are supported by using the home
crate. With the current issue fixed, the two above will be supported as well. Apart from that, I don't see any other mention of the file, it only seems to be created under the installation root.
I forgot to mention it, but as a temporary workaround, you can use the --skip-check
option in the meantime: reading the .crates.toml
file is only done during the version check in order to determine which packages need an update, so if you skip it, no file read will be attempted and the installation should proceed successfully.
from cargo-liner.
@neslinesli93 This should now be fixed, so you can update your installation with cargo install --git https://github.com/PaulDance/cargo-liner.git
until I publish a proper patch release with #5 as well, probably some time tomorrow.
from cargo-liner.
Fix released as part of v0.4.1.
from cargo-liner.
Related Issues (14)
- Consider using Cargo's testing framework to implement offline validation tests HOT 1
- Optionally continue with installation even if some package fails HOT 1
- Add an ending report
- Use a table presentation library to better display the version check results HOT 2
- use cargo binstall if possible HOT 4
- ignore pre releases by default HOT 1
- ignore locally installed packages when importing HOT 1
- Allow to pass options to `cargo install` HOT 5
- Add a subcommand for shell auto-completion script generation
- `ship --skip-check` should not read `.crates.toml` HOT 2
- No regex capture while parsing search output for ... HOT 8
- Package names can inject options into calls to Cargo commands HOT 1
- The version check does not respect requirements HOT 3
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 cargo-liner.