# How run script in Juno with parameters?

**URL:** <https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362>\
**Category:** New to Julia\
**Created:** [March 1, 2020, 4:25pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362 "2020-03-01T16:25:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 1, 2020, 4:25pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/1 "2020-03-01T16:25:03Z")

</div>

Is possible to run Julia file in Juno , as running it as command line passing it some arguments? i don’t know where i can specify arguments in running a script in Juno …

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 1, 2020, 5:47pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/2 "2020-03-01T17:47:06Z")

</div>

This does not directly answer your question, but I would just separate argument parsing from the function that actually does the work, and just call the latter.

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 2, 2020, 10:58am UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/3 "2020-03-02T10:58:56Z")

</div>

This does not directly answer your question too, but could help:

I use Juno in Atom. For Atom, there is a package called _script_ [script](https://atom.io/packages/script) , and it is possible with the package to run a script with command line parameters. I have used it to pass arguments to a Python script, but it will run a Julia script just as well (I have tested on a simple Julia script, however without arguments).

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 2, 2020, 11:57am UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/4 "2020-03-02T11:57:57Z")

</div>

There’s an `Arguments` option under Settings → Packages → julia-client → Settings → Julia Options:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/6/5608dccd968a9dccc1ae12924469fff3ab293cd7.png)

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 2, 2020, 12:42pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/5 "2020-03-02T12:42:03Z")

</div>

I have found now this option, but I don’s see where can I enter the script arguments.  
 ![2020-03-02 13_40_24-REPL — C___MyOwnDocs_SoftwareDevelopment_JulTests — Atom](https://global.discourse-cdn.com/julialang/original/3X/e/d/ed86b97f93111eb6072bd0d87b6b0b15f028e7f1.png)

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 2, 2020, 12:44pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/6 "2020-03-02T12:44:12Z")

</div>

That’s an Atom bug – just click on the zero-height textbox.

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 2, 2020, 10:18pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/7 "2020-03-02T22:18:22Z")

</div>

Damn, and who would have thought that that line was the field where to insert the arguments … in fact it works!  
Thanks.

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 2, 2020, 10:24pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/8 "2020-03-02T22:24:45Z")

</div>

> [@Tamas\_Papp](#):
>
> This does not directly answer your question, but I would just separate argument parsing from the function that actually does the work, and just call the latter.

Oh yes, i understand what you mean … but i have a script running in this way:

```julia
julia search.jl -w "word1 word2 word3" -e 20

```

and i would see in REPL of juno, debugging, if argument to my script are correctly passed to function,  
because before to pass to it, they must be checked, perhaps modified, ecc ecc

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 2, 2020, 10:30pm UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/9 "2020-03-02T22:30:06Z")

</div>

I also find this way, because it is not so good the args parameterer passing in Juno ( i have other IDE for Python, for example, that memorize argument given for a string and simply disactive/active arguments … better than what i see in Juno).  
I put in the start of my script this code to manipolate ARGS array

```julia
if false
  empty!(ARGS)
  push!(ARGS, "-w")
  push!(ARGS, "anima corpo sangue")
  push!(ARGS, "-e")
  push!(ARGS, "20")
end

```

and if i want to test from Juno, i set to true the if, so Julia add to ARG the argument as they come from command line … ok fine. 🙂

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 3, 2020, 7:05am UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/10 "2020-03-03T07:05:59Z")

</div>

> [@Darione](#):
>
> if argument to my script are correctly passed to function,  
> because before to pass to it, they must be checked, perhaps modified, ecc ecc

All you get from the command line is `ARGS`. You can organize the whole logic of parsing that into a function

```julia
function parse_args(args)
    ...
end

```

and test it with

```julia
parse_args(["-w", "word1 word2 word3", "-e", "20"])

```

then just use it as `parse_args(ARGS)`.

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 5, 2020, 9:30am UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/11 "2020-03-05T09:30:02Z")

</div>

Thanks, ok, i will do so!

---

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [March 12, 2020, 6:29am UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/12 "2020-03-12T06:29:41Z")

</div>

> [@pfitzseb](#):
>
> That’s an Atom bug – just click on the zero-height textbox.

Do you happen to know an Atom Issue I can follow for this? I’ve had this problem for quite a while now too.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 12, 2020, 8:46am UTC](https://discourse.julialang.org/t/how-run-script-in-juno-with-parameters/35362/13 "2020-03-12T08:46:30Z")

</div>

I couldn’t find one, actually. Would be good to open an issue [here](https://github.com/atom/settings-view/issues), but I can’t actually repro the bug right now…
