Obtaining Help

You can always use the --help flag on each of the actions. That will print a brief explanation of each of the flags.

Help

This action prints a basic help showing all available actions

sdm help
-> % sdm help                                                       
Usage: sdm <action>

Actions:
   add-repository
   install
   uninstall
   update
   search
...
   help
   --version

Add-Repository

Download and add a new remote repository to your local repository. This is the first step before using sdm.

sdm add-repository -n default -u git://github.com/orpiske/sdm-packages.git

Install

This action installs a package on your $HOME/software directory (or whatever you configured in the sdm.properties file. For instance:

sdm install -p apache-maven

However, running the command above will cause a collision because multiple packages with that name exist:

More than one match found. Please specify either the version (-v) or the group (-g) name: 
...
Group ID: org.apache
Name: apache-maven
Version: 2.2.1
Type: BINARY
File: /Users/otavio/.sdm/repositories/default/packages/org.apache/apache-maven/2.2.1/pkg/apache-maven.groovy
...
Group ID: org.apache
Name: apache-maven
Version: 3.0.5
Type: BINARY
File: /Users/otavio/.sdm/repositories/default/packages/org.apache/apache-maven/3.0.5/pkg/apache-maven.groovy
Too many packages found: apache-maven

To prevent collisions, so you'll need to inform the specific version (-v) and, eventually, the group id (-g):

sdm install -p apache-maven -v 2.2.1

Running the command above one more time, will cause a registry collision.

The package org.apache/apache-maven-2.2.1 is already installed

Group ID: org.apache
Name: apache-maven
Version: 2.2.1
Type: B
Installation date: 2013-03-07 13:46:22.92
Installation directory: /Users/otavio/software/apache-maven-2.2.1
Multiple installed packages found apache-maven

If you want to reinstall the package, --reinstall comes at your rescue:

sdm install -p apache-maven -v 2.2.1 --reinstall

Finally, SDM caches the downloaded package. This may consume disk space. To clean it up, you can provide --cleanup to the command-line:

sdm install -p apache-maven -v 2.2.1 --reinstall --cleanup

Uninstall

To uninstall the apache-maven package, run:

sdm uninstall -p apache-maven 

Just like with install, there can be package collisions. Use -g and -v to resolve them.

Search

To search for an available package, run:

sdm search -p apache-maven

If the package is available on the repository, it should print something like this:

Group ID: org.apache
Name: apache-maven
Version: 3.0.5
Type: BINARY
File: /Users/otavio/.sdm/repositories/default/packages/org.apache/apache-maven/3.0.5/pkg/apache-maven.groovy

To search for installed packages, run:

sdm search -p apache-maven -i

A sample output for the above command, could be:

Group ID: org.apache
Name: apache-maven
Version: 3.0.5
Type: B
Installation date: 2013-03-03 18:27:31.31
Installation directory: /Users/otavio/software/apache-maven-3.0.5

You can also request for machine-parseable output using --parseable:

-> % sdm search -a -i --parseable                                            
Group ID           Package Name            Version     Type  Install Date               Install Dir
org.apache      => apache-ant           => 1.8.4     => B => 2013-03-03 18:27:48.366 => /Users/otavio/software/apache-ant-1.8.4
org.apache      => apache-derby         => 10.9.1.0  => B => 2013-03-03 18:28:27.678 => /Users/otavio/software/apache-derby-10.9.1.0
org.apache      => apache-maven         => 2.2.1     => B => 2013-03-05 21:20:22.866 => /Users/otavio/software/apache-maven-2.2.1
org.apache      => apache-maven         => 3.0.5     => B => 2013-03-03 18:27:31.31  => /Users/otavio/software/apache-maven-3.0.5

The flag -a along with -i will print all installed packages

g Update

The update is used to refresh your local scripts with the remote repository data. To update your local repositories, run:

sdm update