scarb
Eikix opened this issue · 2 comments
Sanity checks
- My issue relates to a specific CLI completion spec (e.g.
git checkout
is missing options ingit
completion spec). If your issue is more general, please create your issue here: withfig/fig - I have searched github.com/withfig/autocomplete/issues and there are no duplicates of my issue
- I would like to work on this.
What CLI tool does this relate to?
Scarb
Which statement makes the most sense?
This completion spec does not exist
Issue Details
I want to create the completion for Scarb: https://docs.swmansion.com/scarb/docs.html
The package manager for Cairo, a provable programming language: https://cairo-book.github.io/
Four commands (can run all of them with --help flag):
test
build
fmt
run
(for scripts)new
(for creating new packages)add
(for adding imports)rm
(for removing imports)
note: Can also run: scarb -h at the root
Can run commands test
, build
and fmt
with --workspace, or --package (-p)
Generators:
scarb test ...
should propose three flags: -h, -w, -p (resp. --help, --workspace, --package)
scarb test -p ...
should propose all packages in the workspace
Same for fmt and build!
scarb run should not propose all scripts in the packages as it doesn't work yet
Actually I'm in a bit of a pickle here.
For the flag --package of scarb test --package
, I'd like to write a generator that is able to:
- Find the Scarb.toml at the root of the project
- Check if the project has a [workspace.members] field, e.g:
[workspace]
members = ["crates/*"]
[workspace.package]
description = "Kakarot is an (zk)-Ethereum Virtual Machine implementation written in Cairo."
documentation = "https://www.kakarot.org/"
cairo-version = "2.1.0"
version = "0.1.0"
readme = "README.md"
repository = "https://github.com/kkrt-labs/kakarot-ssj/"
license-file = "LICENSE"
[workspace.dependencies]
starknet = "2.1.0"
[[workspace.tool.starknet-contract]]
- If so, then grab the members field
- Go through all the members files and grab the [package.name] field in nested Scarb.toml files, e.g.:
[package]
name = "evm"
version = "0.1.0"
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html
[dependencies]
starknet.workspace = true
utils = { path = "../utils" }
- And then have the Fig command
scarb test --package
autocomplete based on the list of packages in a Scarb workspace.
This is very akin to what cargo does, but I can't manage to do it right ;p
Actually, drawing inspiration from Cargo! Might work!