Syntax

THIS PAGE CONTAINS INFORMATION FOR VERSION 2.0

The general syntax for FBCMD is:

fbcmd COMMAND parameter1 parameter2... -preference1=value1 -preference2=value2...

Where each command has parameters specific to that command.  In addition, there are preferences that customize the behaviour and/or the output format of FBCMD.

Note: FBCMD is not case sensitive: commands can be in lower case as well

Parameter Format

If a parameter contain a space or other special OS characters (such as *) you should wrap it in quotes. For parameters, wrap the entire parameter including the - in quotes.  For example:

fbcmd status "is really excited to use fbcmd"
fbcmd info me "-oshow=education.*"

Parameters

Each Command has specific required parameters that must be provided in addition to optional parameters that can be omitted. All optional parameters (and many required parameters) have a 'default' value that can be specified with the value of 0 (zero) or typing default.

For example, the ADDPIC syntax is:
fbcmd addpic filename [album_id] [caption]
The filename is required, and the album_id and caption are optional.  If you would like to specify a caption, but use the default album_id, the syntax would be:
fbcmd addpic myphoto.jpg default "Your caption"
Note: that the default value may or may not be blank, so if you wish to explicitly specify a blank parameter use use "" instead of 0.

Many parameters will output numbers (index values) as part of their output.
fbcmd albums
will number all of your photo albums.  You can now use those numbers in a subsequent command as a substitute for the object name.  For example:
fbcmd addpic myphoto.jpg 5
will add the photo to your 5th album from the PREV(ious) result.  To see the results of the previous command again,
fbcmd prev
to see the results from the previous 3 commands, 
fbcmd prev 3
Where you can see that 5.3 will correspond to the 3rd entry from the 5th previous command.

if you want to jump to a page in facebook, you can use the GO command which will attempt to launch a browser at that page.  For example,
fbcmd go 6

Many of the commands can be TARGETed at a particular user.  For example:
fbcmd post "Hello, world!"
will post that on your wall, whereas
fbcmd target bob post "Hello, world!"
will post that on Bob's wall.  You can also use the @ syntax in place of TARGET
fbcmd @bob post "Hello, world!"
You may know more than one person named bob.  If FBCMD cannot resolve which bob you're talking about, it will not execute the command and instead list all the bobs (similar to what happend with ALBUMS).  If that happens, you can repeat the command using the number instead of the bob.
fbcmd target 4 post "Hello, world!"

That can become annoying, so you can use the ALIAS command for convenience.  it works really well with the MATCH command:
fbcmd match bob
will list (and more importantly, number) all the Bobs you know (or like).  Then you can:
fbcmd alias funbob 4
so from now on, funbob will match to the Bob you were looking for.
Pro Tip: The parameter for  MATCH  (and many other commands) can be a regular expression:

Preferences

Most users will not need to change their preferences, but if you would like to customize some of the behaviour of FBCMD there is flexibility.
fbcmd showpref
will list all of your current preferences

For example, the ADDPICD command will look for .jpg files, but you can specify the extension with -addpicd_ext=png.  Many preferences also have a short form alias, so for this example, setting -pext=png is equivalent.

If you just specify just -preference it's the same as -preference=1 (true) and if you specify -preference= with no value it's the same as specifying -preference=0 (false)... which may or may not make sense for a given preference.

Saving Preferences and Setting Defaults

If you would like to make your preference the default setting, you can edit your prefs.php file.  You can also use the SAVEPREF command to update your prefs.php file for you.  From the previous example, the following command:
fbcmd savepref -addpicd_ext=png
will make this the default behaviour.

Many of the default parameter settings are also a preference.  Using the the ADDPICD example again, you can make the default album_id a specific album using the preference
-default_addpicd_albumid=X 

Formatting Your Output

Many of the preferences are related to controlling how the output appears on your screen.  See the Output Formats page for more info.
Comments