https://toitlang.org/ logo
Use jag to determine which version of a package is...
# help
a
I have some docs that want to do copy paste instructions, and I dont want to update them every time a new version of a package is updated. It is somehting like
Copy code
sh
mkdir my-x-project
cd my-x-project
jag pkg init
jag pkg install github.com/x-io/toit-x
then
Copy code
sh
cp ./.packages/github.com/x-io/toit-x/v0.1.1/examples/eink.toit ./main.toit
But I dont want to hardcode v0.1.1 Is there already a command I am missing that might say what is installed and being used by the project?
ls ./.packages/github.com/x-io/toit-x/ | sort -V | tail -n 1
is the best i can some up with, but a bit evil, and techncially the highest thing on disk may not be what is used..?
f
I would definitely not rely on it. I'm in the process of rewriting the package manager (this time in Toit), and it won't (necessarily) follow the same directory conventions anymore.
Depending on the tutorial you could just install a specific version of your package.
that would hardcode the version a bit earlier, but at least the steps would always work.
For now, you could use the package.lock file. That's how the compiler finds the packages:
Copy code
builder.join(package_dirs[i]);
        builder.join(entry.url);
        builder.join(entry.version);
As I said: I intend to change this in the future. (using the URLs as path is problematic; especially on Windows)
a
VERSION=$(jag pkg search lightbug-io/toit-lightbug | awk '{print $3}')
😛
although now I'm depending on awk xD
f
And you might also run into issues with the new version of
toit pkg
.
The output might change.