# Add "version" command to pkg

**URL:** <https://discourse.julialang.org/t/add-version-command-to-pkg/70549>\
**Category:** Internals & Design\
**Tags:** pkg\
**Created:** [October 28, 2021, 1:11pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549 "2021-10-28T13:11:56Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [October 28, 2021, 1:11pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/1 "2021-10-28T13:11:56Z")

</div>

The current behaviour is the following:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/2/42efbf867ded4ed11a0529eaa8bf6b904a1fd06d.png)

I feel that “version” is a more natural command, and that it should be added to return the same thing as “status”. It should save a lot of people trying “version” first, and then googling the correct command “status”.

Is there a good reason not to do this?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [October 28, 2021, 1:19pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/2 "2021-10-28T13:19:59Z")

</div>

This seems like a reasonable idea.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [October 28, 2021, 3:11pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/3 "2021-10-28T15:11:57Z")

</div>

> [@TheLateKronos](#):
>
> Is there a good reason not to do this?

Multiple commands for the same thing is usually not very good.

> [@TheLateKronos](#):
>
> It should save a lot of people trying “version” first, and then googling the correct command “status”.

Are there a lot of people trying `version`? Is there another package manager that uses `version` or why would you assume that to be available in Pkg?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [October 28, 2021, 3:13pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/4 "2021-10-28T15:13:49Z")

</div>

`version` seems like a pretty good guess for how to get the version of a package. Julia’s package api generally uses the most obvious name for the operation. `status` is probably right for the status of all packages, but to get a version of a specific package, `version` seems reasonable.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [October 28, 2021, 3:26pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/5 "2021-10-28T15:26:52Z")

</div>

Maybe instead of “Could not determine command” we could print “unknown command $cmd.\nAvailable commands: add, dev, up, st, …”

---

<div class="post-metadata">

**Author:** ![Fliks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fliks/32/2494_2.png) [@Fliks](https://discourse.julialang.org/u/Fliks)\
**Post date:** [October 28, 2021, 3:38pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/6 "2021-10-28T15:38:48Z")

</div>

I think it would be better to hint to the `help` command, because otherwise we would have to decide which commands to include and this could become cluttered very quickly.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [October 28, 2021, 4:01pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/7 "2021-10-28T16:01:35Z")

</div>

Couldn’t `version` just return `1.7.1`?

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [October 28, 2021, 5:22pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/8 "2021-10-28T17:22:48Z")

</div>

> [@fredrikekre](#):
>
> Is there another package manager that uses `version` or why would you assume that to be available in Pkg?

Even if not as a command, then as an option the `version` (`--version`, `-v`) is quite common elsewhere, isn’t it? I can understand why it is somebody’s first guess.

And Matlab uses [version](https://www.mathworks.com/help/matlab/ref/version.html) and [ver](https://www.mathworks.com/help/matlab/ref/ver.html) as commands.

```julia
>> version

ans =

    '9.11.0.1769968 (R2021b)'

>> ver Simulink
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.11.0.1769968 (R2021b)
MATLAB License Number: ...
Operating System: Linux 5.11.0-38-generic #42-Ubuntu SMP Fri Sep 24 14:03:54 UTC 2021 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
Simulink Version 10.4 (R2021b)

```

This is not to say that Julia should follow Matlab, I am far from that attitude and I am happy that Julia goes its own way, it is just that you were asking.

---

<div class="post-metadata">

**Author:** ![ianshmean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ianshmean/32/216042_2.png) [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Post date:** [October 30, 2021, 5:59am UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/9 "2021-10-30T05:59:09Z")

</div>

Good suggestion [https://github.com/JuliaLang/Pkg.jl/pull/2811](https://github.com/JuliaLang/Pkg.jl/pull/2811)

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 1, 2021, 12:56pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/10 "2021-11-01T12:56:01Z")

</div>

> [@fredrikekre](#):
>
> Multiple commands for the same thing is usually not very good.

This is a good point. But in some cases, aliases are useful. I point to `Vector{Float64} (alias for Array{Float64, 1})` as an example where I think we all agree that this rule can be broken. Because I do not see the harm in having an alias here, I am still in support of it.

> [@fredrikekre](#):
>
> Are there a lot of people trying `version` ?

I don’t have data on how many people do this. But I naivly did this myself, and I have spent a fair amount of time reading documentation etc - more that I expect the casual user to have done. So my thinking is that if I messed it up, I am _certain_ that I am not first nor last.

> [@lmiq](#):
>
> Couldn’t `version` just return `1.7.1` ?

That would be great! I actually think that the following would make a lot of sense:  
`(@v1.6) pkg> version` returns the current Julia version.  
`(@v1.6) pkg> version SomePackage` returns the version of `SomePackage`.  
`(@v1.6) pkg> versions ` returns same thing as `status`, but with the julia version as the first entry, making it a complete list of all version of the current enviroment.

I think that these commands are so natural, that even if one would want to use the commands for something else, one should not do it, as I think my suggestions would be the expected output for most users.

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [November 1, 2021, 2:30pm UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/11 "2021-11-01T14:30:32Z")

</div>

> [@TheLateKronos](#):
>
> Because I do not see the harm in having an alias here

I see the usual harm of adding uncertainty, and making Pkg easier to get something working by chance (by guess), but harder to master. For example if I found by chance that `version` works, then later see someone mentioning `status`, I won’t be sure if it’s the same thing. Making things fuzzy like that is a bad idea I think. On the contrary if I know there aren’t aliases left and right, if I learned `status` and see a mention of `version`, I know there’s a new interesting command for me to learn.

By the way `Vector` as an alias for a certain kind of `Array` makes sense: it corresponds to something more specific than `Array` and makes code more readable. I’m happy we don’t have e.g. `Table` as alias for `Array` because _that_ would be redundant 🙂

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 2, 2021, 7:25am UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/12 "2021-11-02T07:25:10Z")

</div>

Alright, I have found your comment rather persuasive. How about adding a hint for what the user might mean? Similar to the line starting with `search:` returned in this example.

```julia
help?> version
search: versioninfo VersionNumber VERSION reverseind

Couldn't find version
Perhaps you meant versioninfo
  No documentation found.

  Binding version does not exist.

```

And making it so that `st` and `status` show up when the input is `version`.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 2, 2021, 7:49am UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/13 "2021-11-02T07:49:28Z")

</div>

[https://github.com/JuliaLang/Pkg.jl/pull/2811](https://github.com/JuliaLang/Pkg.jl/pull/2811) is enough to “fix” this, in my opinion.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 2, 2021, 8:21am UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/14 "2021-11-02T08:21:07Z")

</div>

I agree that it is enough. But would it not be even better for a new user to give some educated guesses, as is currently implemented in `help` mode? If yes, then why not do it?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 2, 2021, 10:05am UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/15 "2021-11-02T10:05:52Z")

</div>

The hint is just based on textual similarity so it wouldn’t link `version` and `status` anyway.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 2, 2021, 10:26am UTC](https://discourse.julialang.org/t/add-version-command-to-pkg/70549/16 "2021-11-02T10:26:59Z")

</div>

I was thinking that one could add a sentence about `version` in the docstring for status. But it could be true that that is more trouble than it is worth, and that all is swell now with PR#2811 merged.
