You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Andreas Sewe <an...@codetrails.com> on 2013/01/08 18:12:02 UTC

Gogo shell: Display a banner at shell startup?

Hi,

I am looking for a way to display a banner at (or shortly after) the
time Gogo shell starts up? Is there a way to achieve this effect?

The only (admittedly) horrible hack I can imagine is to print something
to System.out in my autostarted bundle's BundleActivator.start(..). But
that of course doesn't go through the official channel, i.e., the
current CommandSession. Maybe there is a way to obtain said session and
output the banner that way?

Any help would be greatly appreciated.

Andreas
-- 
Codetrails.com - the knowledge transfer company

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Gogo shell: Display a banner at shell startup?

Posted by Derek Baum <de...@baums.org.uk>.
The gogo console automatically prints the value of the last interactive
command.

When running a script, the result of each intermediate command is not
printed.

You can control this behaviour as follows (taken from comment in
gosh_profile)

  ## disable console auto-formatting of each result
  #  you will then need to explicitly use the 'format' command
  #  to print the result of commands that don't write to stdout.
  #.Gogo.format = false

--
Derek


On 9 January 2013 16:36, Andreas Sewe <an...@codetrails.com> wrote:

> Hi Richard,
>
> > I believe you can override the gosh_profile file by putting it in an
> > etc/ directory either in user.dir or whichever directory you set via
> > gosh.home config property.
>
> thanks, that works very well. :-)
>
> One question, though: Why does a String-returning banner() command not
> display anything in gosh_profile when using "banner", when it works when
> using "banner | cat"? As far as I can tell from the source code, the
> gosh_profile file is 'sourced', so I would expect "banner" to behave the
> same, whether entered on the command line or 'sourced' from gosh_profile.
>
> But that's just a minor issue; I am just curious of why there is a
> difference.
>
> Best wishes,
>
> Andreas
> --
> Codetrails.com - the knowledge transfer company
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Gogo shell: Display a banner at shell startup?

Posted by Andreas Sewe <an...@codetrails.com>.
Hi Richard,

> I believe you can override the gosh_profile file by putting it in an
> etc/ directory either in user.dir or whichever directory you set via
> gosh.home config property.

thanks, that works very well. :-)

One question, though: Why does a String-returning banner() command not
display anything in gosh_profile when using "banner", when it works when
using "banner | cat"? As far as I can tell from the source code, the
gosh_profile file is 'sourced', so I would expect "banner" to behave the
same, whether entered on the command line or 'sourced' from gosh_profile.

But that's just a minor issue; I am just curious of why there is a
difference.

Best wishes,

Andreas
-- 
Codetrails.com - the knowledge transfer company

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Gogo shell: Display a banner at shell startup?

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Gogo uses the gosh_profile file to do some work at shell session startup 
and this is where it displays its motd.

I believe you can override the gosh_profile file by putting it in an 
etc/ directory either in user.dir or whichever directory you set via 
gosh.home config property.

So, you could just modify the default gosh_profile to print your banner.

Alternatively, if you don't mind having a special build for the Gogo 
bundle, just edit its motd resource and then rebuild.

-> richard

On 1/8/13 12:12 , Andreas Sewe wrote:
> Hi,
>
> I am looking for a way to display a banner at (or shortly after) the
> time Gogo shell starts up? Is there a way to achieve this effect?
>
> The only (admittedly) horrible hack I can imagine is to print something
> to System.out in my autostarted bundle's BundleActivator.start(..). But
> that of course doesn't go through the official channel, i.e., the
> current CommandSession. Maybe there is a way to obtain said session and
> output the banner that way?
>
> Any help would be greatly appreciated.
>
> Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org