2

I'm making a script with Turtle and I need a dependency from GitHub. I saw that you can add such a dependency when you make a project by putting this in your stack.yaml:

packages:
- location:
    git: https://github.com/githubuser/reponame.git
    commit: somecommitID

But is it possible to add it via the command line?

This is the command line used to run the script:

stack --resolver lts-3.2 --install-ghc runghc --package turtle

Edit:

These are the first lines of my script:

#!/usr/bin/env stack
-- stack --resolver lts-3.1 --install-ghc runghc --package turtle

import Turtle
...
Elie Génard
  • 1,673
  • 3
  • 21
  • 34
  • `stack runghc` is excuted in the global project. You can add the dependency to the `stack.yaml` of your global project. – zakyggaps Feb 24 '16 at 11:44
  • 1
    Or you can put a `stack.yaml` file along with your script and refer this config file in your script by `--stack-yaml ./your-stack.yaml` to achieve some portability, but the additional package still have to be installed in your global project I guess. – zakyggaps Feb 24 '16 at 11:56
  • The thing is that I don't have a global project. I'd like to execute this script as a standalone program, as you can do with a normal turtle script. – Elie Génard Feb 24 '16 at 12:34
  • That's weird. When I run `stack runghc` I see "Run from outside a project, using implicit global project config, using resolver: lts-5.1 from implicit global project's config file:\path\to\global\stack.yaml" in my console, are you sure the behavior of your stack is different? – zakyggaps Feb 24 '16 at 12:44

1 Answers1

3

We do not support all of stack.yaml options on the commandline. I recommend putting a stack.yaml somewhere. If you don't want to just put it in the same folder as the script, use "--stack-yaml"

mgsloan
  • 3,245
  • 21
  • 20