Skip to content

Changing order of parameters of julia CLI shouldn't change behavior #28643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
s-celles opened this issue Aug 14, 2018 · 6 comments
Closed

Changing order of parameters of julia CLI shouldn't change behavior #28643

s-celles opened this issue Aug 14, 2018 · 6 comments

Comments

@s-celles
Copy link
Contributor

Hello,

Following JuliaDocs/Documenter.jl#790 (comment) I noticed that

10:27 $ julia --depwarn=error docs/mk_doc.jl
Documenter: setting up build directory.
Documenter: expanding markdown templates.
 !! No docs found for 'find(m::SortedDict, k_)'. [src/sorted_containers.md]
WARNING: importing deprecated binding Base.Associative into DataStructures.
Base.Associative is deprecated, use AbstractDict instead.
ERROR: LoadError: deprecated binding: Base.Associative
Stacktrace:
 [1] top-level scope at none:0
in expression starting at /Users/scls/.julia/dev/DataStructures/docs/mk_doc.jl:4
✘-1 ~/.julia/dev/DataStructures [master|✚ 1…5]

but

10:29 $ julia docs/mk_doc.jl --depwarn=error
Documenter: setting up build directory.
Documenter: expanding markdown templates.
 !! No docs found for 'find(m::SortedDict, k_)'. [src/sorted_containers.md]
WARNING: importing deprecated binding Base.Associative into DataStructures.
WARNING: Base.Associative is deprecated, use AbstractDict instead.
  likely near /Users/scls/.julia/dev/DataStructures/docs/mk_doc.jl:4
WARNING: Base.Associative is deprecated, use AbstractDict instead.
  likely near /Users/scls/.julia/dev/DataStructures/docs/mk_doc.jl:4
Documenter: building cross-references.
 !! No doc found for reference '[`Bool`](@ref)'. [src/sorted_containers.md]
Documenter: running document checks.
 > checking for missing docstrings.
 > running doctests.
 > checking footnote links.
Documenter: populating indices.
Documenter: rendering document.
Documenter: copying assets to build directory.

Changing order of parameters of julia CLI shouldn't change behavior

Kind regards

@KristofferC
Copy link
Member

This is to pass arguments into the julia program

➜ echo '@show ARGS' > args.jl
➜ julia args.jl --depwarn=error
ARGS = ["--depwarn=error"]

@s-celles
Copy link
Contributor Author

$ julia args.jl --depwarn=error docs/mk_doc.jl
ARGS = ["--depwarn=error", "docs/mk_doc.jl"]
$ julia args.jl docs/mk_doc.jl --depwarn=error
ARGS = ["docs/mk_doc.jl", "--depwarn=error"]

The problem here is that there is 2 kind of arguments positional arguments and optional arguments.

The position of an optional argument shouldn't affect behavior of a CLI.

In the first case julia --depwarn=error docs/mk_doc.jl depwarn are considered as error, not in the second one (ie julia docs/mk_doc.jl --depwarn=error)

@s-celles
Copy link
Contributor Author

s-celles commented Aug 14, 2018

I know Python and Julia are differents but

main.py

import click

@click.command()
@click.argument('file')
@click.option('--depwarn', default='warn')
def main(file, depwarn):
    print("hello with %s %s" % (file, depwarn))

if __name__ == '__main__':
    main()
$ python main.py --depwarn=error file.txt
hello with file.txt error
$ python main.py file.txt --depwarn=error
hello with file.txt error
$ python main.py file.txt
hello with file.txt warn

Order of an optional doesn't affect behavior of this CLI
I thought that was quite standard in CLI world (especially *nix).

@KristofferC
Copy link
Member

What you did in the original post was the same as

python --depwarn=error main.py

vs

python main.py --depwarn=error

@s-celles
Copy link
Contributor Author

Ok in one case it's arguments of python cli (or julia cli) and in the other case it's arguments of the Python/Julia script.
Sorry for noise

@s-celles
Copy link
Contributor Author

Thanks @KristofferC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants