Overview

One of the nice things Solar has to offer is its CLI (Command Line Interface), which can be used to accomplish tasks that would otherwise eat up valuable time, such as creating a new project, applications, models, tests, and documentation. In this entry, and others that will follow, I will be showing you how to use the current (Solar v1.0.0 alpha2) CLI, detailing commands, available options, parameters, and usage examples. So make sure that you have a fresh pot of coffee and let's get to it!

First Glance

Under a Solar system you will find an executable called solar, located in the script directory. For our example, let's assume our Solar system is installed under /var/www/solar/. You will find the executable under the directory /var/www/solar/script/.

From the terminal, change directories to /var/www/solar/. Let's go ahead and run the solar executable and examine what is returned.

$ ./script/solar
Using include_path '.:..:/var/www/solar/include'.
Using config file '/var/www/solar/config/Solar.config.php'.
Solar command-line tool.

Usage: solar <command> <options> <params>

Try 'solar help' for a list of commands.

Here we can see what our include paths are, as well as the configuration file we are using. In a Solar system, Solar defaults to using Solar.config.php, the default configuration file.

You will also notice that the Solar CLI gives you the proper syntax to use, solar <command> <options> <params>. This is important so keep it in mind as we go along. For now, let's jump to the most basic command and the most helpful, help.

Help Command

We can learn more about any command in the CLI by using the help command. The syntax for this is solar help <command> where <command> is the command we want to know more about. We can also get a list of available commands by typing solar help. Let's give that a try, shall we?

$ ./script/solar help
Using include_path '.:..:/var/www/solar/include'.
Using config file '/var/www/solar/config/Solar.config.php'.
Solar command-line tool.

Usage: solar <command> <options> <params>

Try 'solar help <command>' for help on a specific command.
Available commands are:
    base
    help
    make-app
    make-docs
    make-model
    make-tests
    make-vendor
    run-tests

You can ignore the base command since this is just the command in which all other commands extend and is of no value to us here.

Here is a quick break down of each command.

  • base - Base class in which all commands extend. Not usable from the CLI!
  • help - Returns command usage or a list of available commands.
  • make-app - Generates a basic application or an application with BREAD functionality.
  • make-docs - Generates package and API documentation files.
  • make-model - Generates a model class from a SQL table.
  • make-tests - Generates a test class (or set of classes) from a given class.
  • make-vendor - Creates the appropriate directories and symlinks for a new project (also referred to as a vendor space).
  • run-tests - Runs a series of tests or a single test.

Please note that all commands have the following available options:

  • --config - Allows you to use a specific configuration file. If none is specified, this defaults to Solar.config.php.
  • -V | --version - Returns version information.
  • -v | --verbose - Displays verbose output when available.

What's Next?

Now that you have a grasp on how the Solar CLI environment works, you probably want to get your hands dirty with it. In the next several blog entries, I will provide you with detailed information on each CLI command.

If you can not wait until then, I encourage you to explore the CLI yourself. Remember, you can learn more about any command by using the help command (solar help <command>). The following resources may also be of some help on your new found journey.

And as always, join the Solar mailing list and/or IRC channel if you are still stuck. We would love to hear from you!

Comments

No comments

Add A Comment
Your email address will not be disclosed.


Local