set alias in build.sbt

1,265 views
Skip to first unread message

Diego Medina

unread,
Aug 3, 2012, 8:38:52 PM8/3/12
to simple-build-tool
Hi,

I run this command pretty often:

;container:stop; container:start;

Today I found out I can do (form the sbt prompt

alias s = ;container:stop; container:start;

so then I just type

> s

and the magic happens.

Is there a way to include this in build,sbt?

Thanks

Diego

--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com

Mark Harrah

unread,
Aug 3, 2012, 11:15:33 PM8/3/12
to simple-b...@googlegroups.com
Hi Diego,

On Fri, 3 Aug 2012 20:38:52 -0400
Diego Medina <di...@fmpwizard.com> wrote:

> Hi,
>
> I run this command pretty often:
>
> ;container:stop; container:start;
>
> Today I found out I can do (form the sbt prompt
>
> alias s = ;container:stop; container:start;
>
> so then I just type
>
> > s
>
> and the magic happens.
>
> Is there a way to include this in build,sbt?

In 0.12.0, there is a method addCommandAlias. You would add the line:

addCommandAlias("s", ";container:stop; container:start;")

-Mark

> Thanks
>
> Diego
>
> --
> Diego Medina
> Lift/Scala Developer
> di...@fmpwizard.com
> http://www.fmpwizard.com
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
>

fmpwizard

unread,
Aug 6, 2012, 11:34:57 AM8/6/12
to simple-b...@googlegroups.com
Hi Mark,

Thanks for the answer and I'm sorry I forgot to include that I'm still using 0.11.2 (this is at work, and it may take some time before we can upgrade).
Is there a way in 0.11.2 ?

Thanks
  Diego

Mark Harrah

unread,
Aug 7, 2012, 11:13:04 AM8/7/12
to simple-b...@googlegroups.com
On Mon, 6 Aug 2012 08:34:57 -0700 (PDT)
fmpwizard <fmpw...@gmail.com> wrote:

> Hi Mark,
>
> Thanks for the answer and I'm sorry I forgot to include that I'm still
> using 0.11.2 (this is at work, and it may take some time before we can
> upgrade).
> Is there a way in 0.11.2 ?

You can't put it in build.sbt, but you can put it in .sbtrc or ~/.sbtrc. Each line in .sbtrc is evaluated as a command before the project is loaded.

-Mark

> Thanks
> Diego
>
>
> On Friday, August 3, 2012 8:38:52 PM UTC-4, Diego Medina wrote:
> >
> > Hi,
> >
> > I run this command pretty often:
> >
> > ;container:stop; container:start;
> >
> > Today I found out I can do (form the sbt prompt
> >
> > alias s = ;container:stop; container:start;
> >
> > so then I just type
> >
> > > s
> >
> > and the magic happens.
> >
> > Is there a way to include this in build,sbt?
> >
> > Thanks
> >
> > Diego
> >
> > --
> > Diego Medina
> > Lift/Scala Developer
> > di...@fmpwizard.com
> > http://www.fmpwizard.com
> >
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/MSK2kyrcyF4J.

Diego Medina

unread,
Aug 7, 2012, 2:11:42 PM8/7/12
to simple-b...@googlegroups.com
Thanks Mark

Pat

unread,
Jan 15, 2014, 5:21:41 AM1/15/14
to simple-b...@googlegroups.com, di...@fmpwizard.com
Hello,

This doesn't seem to work for me.

In my build.sbt, I've got:

addCommandAlias("a", "about")

However, when I restart sbt, the alias is not defined:

> a
[error] Not a valid command: a
[error] Not a valid project ID: a
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: a
[error] a

I'm using sbt 0.13.1 and it's definitely picking up the changes in build.sbt (because adding a typo will stop sbt from starting). 

Any ideas?

Cheers,
pat
Reply all
Reply to author
Forward
0 new messages