Coder Social home page Coder Social logo

new task: run about leiningen HOT 8 CLOSED

technomancy avatar technomancy commented on July 24, 2024
new task: run

from leiningen.

Comments (8)

ericlavigne avatar ericlavigne commented on July 24, 2024

I created a plugin for this issue:

 http://github.com/ericlavigne/leiningen-run

from leiningen.

neotyk avatar neotyk commented on July 24, 2024

Also it would be nice if you wouldn't need MainClass for it but just run Clojure script.

from leiningen.

ericlavigne avatar ericlavigne commented on July 24, 2024

I can find MainClass in project.clj. How would I determine which file to use as the script?

One way is to pass it as a commandline argument

  • lein run main.clj

However, I would also like to be able to provide arguments to -main

  • lein run 8080 true

which makes this ambiguous

  • lein run main.clj 8080 true

from leiningen.

ericlavigne avatar ericlavigne commented on July 24, 2024

Is it worth adding a "script" task that is identical to "run" except that it expects a script name?

  • lein run 8080 true
  • lein script main 8080 true

from leiningen.

neotyk avatar neotyk commented on July 24, 2024

How about adding :script to project.clj so you don't have to change optional parameters syntax?

from leiningen.

ericlavigne avatar ericlavigne commented on July 24, 2024

If the project only has one :script, then it seems the only advantage of script vs main class is to avoid "(:gen-class)" and "(defn main []", which will still be needed if you want to create an executable jar for this application.

from leiningen.

vdm avatar vdm commented on July 24, 2024

Though I am not convinced that you must have a script, script functionality could mimic Leiningen's behaviour in how it uses project.clj.

lein run could run main.clj by convention (run.clj might be a better name because it matches the name of the Leiningen task) if it exists. Any other scripts or behaviour could be dispatched from that script. This script wouldn't be run by a executable jar but could be useful for porting legacy Clojure scripts to Leiningen, and non-slime users who run a new repl every time they save their code (they do exist).

I haven't tried lein run yet. If my opinion changes I will feedback here.

from leiningen.

technomancy avatar technomancy commented on July 24, 2024

Closing this issue here; will merge into leiningen proper after the run plugin has seen more use. Thanks!

from leiningen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.