If I want to @cast the print function, it seems to be overloaded when I am running commands with --help and --version flags. Here I add the following lines to FakePkg.jl:
@cast function print(file)
@show file
if splitext(file)[2] == ".toml"
print("hhhh")
else
# An intentional error
error("my casted `print` is loaded!")
end
end
However, if I rename print to show, e.g., the above error disappears:
@cast function show(file)
@show file
if splitext(file)[2] == ".toml"
print("hhhh")
else
# An intentional error
error("my casted `print` is loaded!")
end
end
❯ pkg show Project.toml
file = "Project.toml"
hhhh
❯ pkg --version
0.1.0%
❯ pkg --help
pkg v0.1.0
Usage
pkg <command>
Commands
add fake add
rm fake rm
show
noarguments fake noarguments
registry fake registry
activate fake activate
Flags
-h, --help Print this help message
-V, --version Print version
Version of the package:
run Pkg.status() under your environment that uses Comonicon
julia> Pkg.status()
Project FakePkg v0.1.0
Status `~/Comonicon.jl/example/FakePkg/Project.toml`
[863f3e99] Comonicon v0.12.17
[ff7dd447] FromFile v0.1.5
[14b8a8f1] PkgTemplates v0.7.29
[8dfed614] Test
If I want to
@cast
theprint
function, it seems to be overloaded when I am running commands with--help
and--version
flags. Here I add the following lines to FakePkg.jl:and simplify Comonicon.toml to
and install the command
pkg
.And when I run
pkg --help
orpkg --version
, they throw the error:However, if I rename
print
toshow
, e.g., the above error disappears:Version of the package: run
Pkg.status()
under your environment that usesComonicon