# \[ANN\] IonCLI: your package manager and more in terminal

**URL:** <https://discourse.julialang.org/t/ann-ioncli-your-package-manager-and-more-in-terminal/44946>\
**Category:** Package Announcements\
**Tags:** announcement\
**Created:** [August 14, 2020, 5:16pm UTC](https://discourse.julialang.org/t/ann-ioncli-your-package-manager-and-more-in-terminal/44946 "2020-08-14T17:16:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [August 14, 2020, 5:16pm UTC](https://discourse.julialang.org/t/ann-ioncli-your-package-manager-and-more-in-terminal/44946/1 "2020-08-14T17:16:41Z")

</div>

Although I still have a lot feature want to add to it, I think it’s time to announce this and let people try it since I have been making whoever I know to try it in past few weeks. Thus I’m announcing a new CLI package [IonCLI.jl](https://github.com/Roger-luo/IonCLI.jl). It’s still at an early stage, even I have tested it myself in daily usage for a few weeks, I still expect it to have some glitches, and please file an issue to help improve it if you hit any.

**IonCLI** is a CLI command made for managing Julia packages: most of its commands are the same as Pkg and forwards the arguments you type in terminal to Julia’s package manager [Pkg](https://github.com/JuliaLang/Pkg.jl).

a glance at its help

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/1/81808d8e16cdd76aaf34318f153d9fa641bfd21f.png)

But it also provides some extra commands to make your life easier as a developer:

#### release

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/4/f4e03bb221856f72e45d4bb7d1af9d70e6f759ae.png)

you can directly release a new version of your package from terminal, the IonCLI will automatically:

1. ask if you want to bump your package version according to one of `patch, minor, major` or a given version, if `Y/y` or `enter` then change it
2. commit this change to your git repo and push it
3. create the comment `@JuliaRegistrator register` at this commit

all in one command, e.g type the following in your package directory

```sh
ion release patch

```

will prompt as following

![image](https://global.discourse-cdn.com/julialang/original/3X/e/c/ecf6a8e215ce912abd5ad9554d07ba63cd408f3a.png)

then if you press enter, it will continue to release a new patch version, if you don’t have an environment variable `GITHUB_AUTH` that contains your github token, it will prompt to ask you to type one.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/d/adb1224abc7c3fe27648bb26fd89b963a8223682.png)

and you can click the link it returns to see your comment, which for this case is

> **[bump version to 0.4.3 · Roger-luo/IonCLI.jl@b22ac5f](https://github.com/Roger-luo/IonCLI.jl/commit/b22ac5f0a0c937982d6a85f0e29388d041e683d5)**
>
> The Ion CLI for Julia. Contribute to Roger-luo/IonCLI.jl development by creating an account on GitHub.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/7/173ef4ac4ec65e17659338455cc4b14d5f603f1d.png)

### create

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/1/31ff917ea493d7d4cc35694b2b05cb53c2ce8c59.png)

Sometimes you just have a few fixed templates and you just want to create using those templates using only one command, and this is possible with IonCLI’s create command, you can create a new package via [PkgTemplates](https://github.com/invenia/PkgTemplates.jl) using

```sh
➜ julia_code ion create MyCLIPackage --template comonicon --user Roger-luo
[ Info: Running prehooks
[ Info: Running hooks
 Activating environment at `~/julia_code/MyCLIPackage/Project.toml`
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Updating registry at `~/.julia/registries/Miskatonic`
   Updating git-repo `https://github.com/Happy-Diode/Miskatonic.git`
┌ Warning: Some registries failed to update:
│ — /Users/roger/.julia/registries/General — failed to fetch from repo
│ — /Users/roger/.julia/registries/Miskatonic — failed to fetch from repo
└ @ Pkg.Types /Users/runner/hostedtoolcache/julia/1.5.0/x64/share/julia/stdlib/v1.5/Pkg/src/Types.jl:1194
No Changes to `~/julia_code/MyCLIPackage/Project.toml`
No Changes to `~/julia_code/MyCLIPackage/Manifest.toml`
 Activating environment at `~/.julia/packages/IonCLI/2bIDV/Project.toml`
[ Info: Running posthooks
[ Info: New package is at /Users/roger/julia_code/MyCLIPackage

```

### (fuzzy) search

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/8/c860696a3364eca81dfbe1ee29dce1a5351ffda3.png)

sometimes you just don’t remember the exact name, don’t worry, you don’t have to move to your mouse and open your browser and type some words in a search engine, you can just do it in your terminal!

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/c/7cf017c393ff73da4f5d271a0f0d1c2a649fe061.png)

and the word to search doesn’t have to be exact or first few letters, it’s fuzzy

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/d/1daed620b1f1bf2dfd02c95afe3f368542461d24.png)

* * *

But with all these complicated features, I guess all you want to ask might be: isn’t this gonna be slow? given Julia has the latency issue at this moment. Do I have to compile a system image locally myself?

No. IonCLI builds a system image using GitHub Actions, it will try to download the tarball directly instead of waiting for PackageCompiler to compile every time you install/upgrade it locally. And since it’s compiled and executed using `compile=min`, the startup time of IonCLI is around the julia compiler’s startup time, which on my desktop with a Ryzen 3900X CPU, is about 80ms.

* * *

## Differences between IonCLI and [jlpkg](https://github.com/fredrikekre/jlpkg)

IonCLI does not simply forward the command to Julia’s package mode, thus you might find the workflow and commands is a bit different from using `jlpkg` or package mode:

1. all the commands by default are executed in current local project environment
2. all the commands that needs to be executed in global shared environment need to be specified by `-g, --glob` flag

the reason is in terminal unlike REPL, you always `cd` to your project to use other tools, thus like many other languages’ command line manager, it will use the local project as prior.

## IonCLI as the best practice of [Comonicon](https://github.com/Roger-luo/Comonicon.jl)

You might have noticed my previous release on this CLI generator: [Comonicon.jl - Fast, Simple and Light weight CLI generator](https://discourse.julialang.org/t/comonicon-jl-fast-simple-and-light-weight-cli-generator/43744)

and yes, IonCLI is made by `Comonicon`, thus all the shell command syntax of `IonCLI` follows the design of `Comonicon`, it limits some shell features, but I believe it makes all the commands made by Comonicon to follow a unified flavor.

If you want to make your own CLI package, you can also take IonCLI as a reference for sure!

#### Simple Implementation and extensibility

Since it’s generated by Comonicon, it does not handle shell commands by itself at all, you can even just use `IonCLI` as a normal package, and extend it by overloading it’s functions.

#### Shell Auto-Completion

currently, `ion` supports shell autocompletion for `zsh` and it is generated automatically by Comonicon. But if you know how to do autocompletion for other shells please help and contribute!

* * *

## Future Plans

The idea of **IonCLI** is to free you from pressing too much buttons in some common manage work. Thus there are still a few features I wanted personally but still missing:

- upgrade Julia compiler directly in terminal, something like [jill.py](https://github.com/johnnychen94/jill.py) but I think now it’s possible to do it in pure Julia
- better package search, current package search is still slow since it will send request to github for all possible match, it would be nice to have some meta info in the registry (e.g a package description), so it can directly search the local registry
- fully standalone binary, currently limited by PackageCompiler, the compiled redistributable binary is about 200MB, which is still quite large, but I’m looking forward to upcoming PackageCompiler improvements mentioned in JuliaCon2020 to reduce this.

I’m not sure what else you want, but now with PackageCompiler and Comonicon, we can build more complicated CLIs without worrying about the latency!

---

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [August 14, 2020, 8:04pm UTC](https://discourse.julialang.org/t/ann-ioncli-your-package-manager-and-more-in-terminal/44946/2 "2020-08-14T20:04:20Z")

</div>

Really cool Rogerlou!

Will you integrate with PackageTemplates.jl? I think it’d be very nice to have that in this baked into a pkg manager.

Also, am I correct in that this is it’s own package manager, not a wrapper around Pkg.jl?

Does it sort out dependency issues? it looks like it might - that would be super exciting.

---

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [August 14, 2020, 8:10pm UTC](https://discourse.julialang.org/t/ann-ioncli-your-package-manager-and-more-in-terminal/44946/3 "2020-08-14T20:10:08Z")

</div>

> [@anon92994695](#):
>
> Also, am I correct in that this is it’s own package manager, not a wrapper around Pkg.jl?

no, it wraps around Pkg for package installation etc. but provides some extra features. I don’t think writing an entirely new package manager is a good idea, especially given that Pkg has a very nice experience in REPL already.

> [@anon92994695](#):
>
> Will you integrate with PackageTemplates.jl? I think it’d be very nice to have that in this baked into a pkg manager.

I searched `PackageTemplates.jl` on github, I didn’t find any package named this, do you mean `PkgTemplates`? it’s already baked in IonCLI, the `create` command is built on it.

> [@anon92994695](#):
>
> Does it sort out dependency issues? it looks like it might - that would be super exciting.

If you always use a local environment, there won’t be much dependency issue, since it’s always an entirely new environment. You can achieve this in REPL using Pkg already.

To be simple, what IonCLI does here is

1. bake in some existing convenient packages into a CLI as commands
2. forward commands to Pkg from CLI
3. provide some extra feature such as releasing a package

---

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [August 14, 2020, 8:38pm UTC](https://discourse.julialang.org/t/ann-ioncli-your-package-manager-and-more-in-terminal/44946/4 "2020-08-14T20:38:06Z")

</div>

Sorry: [GitHub - invenia/PkgTemplates.jl: Create new Julia packages, the easy way](https://github.com/invenia/PkgTemplates.jl)  
Forgot the package name - wish I had a fuzzy search on discourse 😛

---

<div class="post-metadata">

**Author:** ![nucklass](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nucklass/32/11989_2.png) [@nucklass](https://discourse.julialang.org/u/nucklass)\
**Post date:** [March 13, 2021, 10:40pm UTC](https://discourse.julialang.org/t/ann-ioncli-your-package-manager-and-more-in-terminal/44946/5 "2021-03-13T22:40:22Z")

</div>

Just came across this while looking for more elegant solutions for installing multiple Julia versions. Liking ion a ton, just for ease of switching between nightly and stable/ managing symlinks and the like. Great work!
