| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| # |
| # default gosh_profile |
| # only read if etc/gosh_profile doesn't exist relative to the System property |
| # gosh.home or failing that the current directory. |
| |
| # catch all exceptions from this script to avoid it aborting startup |
| try { |
| |
| # ensure gogo commands are found first |
| SCOPE = 'gogo:*' |
| |
| # add methods on BundleContext object as commands |
| #addcommand context ${.context} (${.context} class) |
| # bug: above invokes (String, Object, String) instead of (String, Object, Class) |
| addcommand context ${.context} |
| |
| # add methods on System object as commands |
| addcommand system (((${.context} bundles) 0) loadclass java.lang.System) |
| |
| # alias to print full stack trace |
| e = { $exception printStackTrace } |
| |
| ## 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 |
| |
| ## disable printing the formatted result of a command into pipelines |
| #.Format.Pipe = false |
| |
| # set prompt |
| prompt = 'g! ' |
| |
| # print welcome message, unless we're explicitly told not to... |
| if { $.gosh_quiet } { } { cat ($0 resolve motd) } |
| } { |
| echo "$0: ERROR: $exception" |
| } |
| |
| # end |