sam.cr icon indicating copy to clipboard operation
sam.cr copied to clipboard

FEATURE REQUEST: default task

Open skull-squadron opened this issue 2 years ago • 3 comments

The simplest way seems to be to look for a task named "default" and append it to ARGV.clone when it's empty?. If there's no task named default, then raise.

Current hack:


task "default", ["do:something", "something:else"] do
end

ARGV << "default" if ARGV.empty?
Sam.help

skull-squadron avatar May 30 '23 22:05 skull-squadron

thank you for this suggestion. Is it dictated by a real world scenario of just a suggestion? From my experience such kind of behavior would not be expected - normally you always have some kind of "script/task name" to execute (e.g. in npm, ruby's rake and so on).

imdrasil avatar Jun 05 '23 15:06 imdrasil

There's a need to automatically rebuild local dev tools including sam, ameba, and sentry based on configuration .cr files. Rebuilding each every time would be wasteful.

rake has a default task, and it happens so do make and just. If it's not obvious, they support both file and phony targets to avoid unnecessary expensive tasks.

npm is a different use-case unrelated to a statically-compiled language such as Crystal.

On Mon, Jun 5, 2023 at 10:46 AM Roman Kalnytskyi @.***> wrote:

thank you for this suggestion. Is it dictated by a real world scenario of just a suggestion? From my experience such kind of behavior would not be expected - normally you always have some kind of "script/task name" to execute (e.g. in npm, ruby's rake and so on).

— Reply to this email directly, view it on GitHub https://github.com/imdrasil/sam.cr/issues/21#issuecomment-1577046907, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABWYMBR7BWGYS3AODPF7UTXJX5MDANCNFSM6AAAAAAYUUQOZU . You are receiving this because you authored the thread.Message ID: @.***>

skull-squadron avatar Jun 05 '23 23:06 skull-squadron

looks reasonable. I'll take a look at this later this week

imdrasil avatar Jun 07 '23 12:06 imdrasil