Skip to content
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

How do I get CLI args? #14

Closed
ivopt opened this issue Dec 2, 2019 · 1 comment
Closed

How do I get CLI args? #14

ivopt opened this issue Dec 2, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@ivopt
Copy link

ivopt commented Dec 2, 2019

Hi!

I have and maintain a number of bash scripts to do multiple tasks around a dev infrastructure.
I was quite excited when I saw fleck because it gave me hope to finally use a decent language and still benefit from not needing to install anything specific to run my scripts on a target machine.

Now.. My scripts need CLI arguments, like deploy -on target_machine some_project. But I can't seem to understand how a fleck script would get those CLI args...

Imagining the contrived example of a sillyecho script, what I was looking for was something like:

#!/usr/bin/env flk

(map (fn [l] (println l)) ARGV)

Where ARGV would be some construct that would give me the arguments from the CLI.

This would be invoked like: sillyecho One Two Three
And would output:

One
Two
Three

Is this possible?
If not, could this be added in?

Thanks!

@chr15m chr15m added the enhancement New feature or request label Dec 2, 2019
chr15m added a commit that referenced this issue Dec 3, 2019
@chr15m
Copy link
Owner

chr15m commented Dec 3, 2019

Hey @LynxEyes I forgot that the underlying mal implementation makes this available as a global list called *ARGV*. So your example above becomes:

#!/usr/bin/env flk

(map (fn [l] (println l)) *ARGV*)

Have updated the documentation, thanks for flagging this.

@chr15m chr15m closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants