A command-line interface to force.com
Go
Latest commit 0ef1029 Feb 21, 2017 @dcarroll dcarroll committed on GitHub Merge pull request #367 from KThompso/invalid_credentials_fix
[#143] Fix NPE in whoami
Permalink
Failed to load latest commit information.
Godeps add godeps for travis build Jun 25, 2015
.gitignore Fix static resource Mar 23, 2015
.travis.yml update travis.yml with deps Dec 23, 2016
CONTRIBUTING.md Add step about running go fmt Dec 30, 2013
LICENSE mit license Nov 19, 2013
README.md Fixed typo Jun 24, 2016
active.go Update "force active -a [username]" CLI output Dec 7, 2015
apex.go Corrected "Max/Unix" to "Mac/Linux" Oct 28, 2016
apiversion.go Fixed formatting issues using go fmt Nov 29, 2016
attrs.go finish record namespace Sep 27, 2013
aura.go fix resource path bug Oct 25, 2016
bigobject.go Adds Batching for Bulk update and insert Sep 19, 2015
bulk.go go ftm style fixes Jan 9, 2017
command.go fix login error Jun 19, 2014
command_test.go added bulk commands Mar 6, 2014
config.go export clean up - trace bug fix Oct 24, 2016
create.go fix go vet error Dec 15, 2016
datapipe.go Adds Batching for Bulk update and insert Sep 19, 2015
describe.go Update describe help text Jun 23, 2016
display.go Quote quotes in CSV-formatted output. Oct 25, 2016
error.go Dynamically detect src dir and provide package builder Sep 10, 2014
eventlogfile.go Add eventlogfile command to list and fetch EventLogFile Aug 20, 2015
export.go Removed duplicate reference to CustomApplication Jan 5, 2017
fetch.go go fmt Dec 23, 2016
field.go Fix wording in usage strings Feb 9, 2017
force.go add support for simple create command Dec 15, 2016
force_suite_test.go Add Ginkgo Tests for Packagebuilder.AddFile Dec 1, 2015
help.go Go fmt Jul 9, 2014
import.go Specify Test Level and Tests To Run During Deploy Feb 4, 2016
limits.go build test Jan 28, 2016
log.go Support Deleting Debug Logs Dec 16, 2016
login.go Fixed formatting issues using go fmt Nov 29, 2016
logins.go [#143] Fix NPE in whoami Feb 4, 2017
logins_test.go [#143] Fix NPE in whoami Feb 4, 2017
logout.go still fixing static resource Mar 23, 2015
main.go add support for simple create command Dec 15, 2016
metadata.go go fmt Dec 23, 2016
metadata2.go Adds Batching for Bulk update and insert Sep 19, 2015
notify.go Add config for notifications Sep 10, 2014
oauth.go added lookup and masterdetail field type support Oct 24, 2013
open.go make url open escaped on windows Sep 27, 2013
packagebuilder.go Merge pull request #372 from sfllaw/force-push-metadata-path Feb 21, 2017
packagebuilder_test.go force push src/classes/Source_File.cls-meta.xml Feb 18, 2017
partner.go Error When No Tests Run Jan 12, 2016
password.go handle no login and no accounts, sorted query results Oct 21, 2016
push.go fix resource path bug Oct 25, 2016
pushAura.go fix resource path bug Oct 25, 2016
push_test.go Deploy Custom Metadata Jan 21, 2016
query.go Default query format to csv for non-tty Dec 23, 2016
record.go external id support Dec 12, 2014
security.go Fix wording in usage strings Feb 9, 2017
soap.go Use Default TLS Configuration Feb 16, 2016
sobject.go Bug fixes around push Feb 2, 2015
sort.go massive refactoring, complete subject and field namespaces Oct 1, 2013
test.go export clean up - trace bug fix Oct 24, 2016
test_test.go Error When No Tests Run Jan 12, 2016
trace.go Allow Setting TraceFlags For Other Users Nov 18, 2015
update.go display result of force update Sep 29, 2013
version.go build test Jan 28, 2016
whoami.go refactor to use flags for argument parsing for login and logout Jun 6, 2014

README.md

force CLI v0.22.39

A command-line interface to force.com

Installation

Precompiled Binaries

Can be downloaded from the Current Release Page or by visiting the CLI Home Page.

Compile from Source
$ go get -u github.com/heroku/force

Usage

Usage: force <command> [<args>]

Available commands:
   login     Log in to force.com
   logout    Log out from force.com
   logins    List force.com logins used
   active    Show or set the active force.com account
   whoami    Show information about the active account
   describe  Describe the object or list of available objects
   sobject   Manage standard & custom objects
   field     Manage sobject fields
   record    Create, modify, or view records
   bulk      Load csv file use Bulk API
   fetch     Export specified artifact(s) to a local directory
   import    Import metadata from a local directory
   export    Export metadata to a local directory
   query     Execute a SOQL statement
   apex      Execute anonymous Apex code
   log       Fetch debug logs
   oauth     Manage ConnectedApp credentials
   test      Run apex tests
   security  Displays the OLS and FLS for a given SObject
   version   Display current version
   update    Update to the latest version
   push      Deploy single artifact from a local directory
   aura      Retrieve or deploy Aura components
   password  See password status or reset password
   notify    Should notifications be used
   limits    Display current limits
   help      Show this help

Run 'force help [command]' for details.

login

When you login using the CLI a record of the login is saved. Eventually your token will expire requiring re-authentication. The default login is for all production instances of salesforce.com. Two predefined non-production instances are available using the test and pre aliases. You can set an arbitrary instance to log in to by specifying the instance url in the form of subdomain.domain. For example login-blitz.soma.salesforce.com.

  force login                           # log in to last environment
  force login -i=login                  # log in to production or developer org
  force login -i=test                   # log in to sandbox org
  force login -i=pre                    # log in to prerelease org
  force login -u=un [-p=pw]             # log in using SOAP. Password is optional
  force login -i=test -u=un -p=pw       # log in using SOAP to sandbox org. Password is optional
  force login -i=<instance> -u=un -p=pw # internal only

logout

Logout will delete your authentication token and remove the saved record of that login.

  force logout -u=user@example.org

logins

Logins will list all the user names that you have used to authenticate with the instance URL associated with each one. The active login will be indicated behind the login name in red.

  force logins

active

Active without any arguments will display the currently acctive login that you are using. You can also supply a username argument that will set the active login to the one corresponding to the username argument. Note, just because you set a login as active, does not mean that the token is necessarily valid.

  force active
  force active -a dave@demo.1

whoami

Whoami will display detailed user information about the currently active logged in user. This is Force.com specific information.

  force whomai

sobject

Sobject command gives you access to creating and deleting schema objects. The list argument will list ALL of the objects, both standard and custom, in your org.

  force sobject list
  force sobject create <object> [<field>:<type>]...
  force sobject delete <object>

field

Field gives you the ability to create, list and delete the fields on an object. Fields need to be created one at a time. You can also set required and optional attributes for the type of field. All defaultable field attributes will be defaulted based on the defaults in the web UI.

  force field list Todo__c
  force field create Todo__c Due:DateTime required:true
  force field delete Todo__c Due

push

Push gives you the ability to push specified resources to force.com. The resource will be pulled from ./metatdata/{type}/

  force push -t(ype) StaticResource -n(ame) MyResource.resource
  force -type ApexClass -name MyClass.cls
  force -t ApexPage -n MyPage.page

You can also push all of a specific type of resource from a given folder.

  force push -t StaticResource -f metadata/staticresources/
  force push -t ApexClass -f metadata/classes/
  force push -t ApexPage -f metadata/pages/

notify

Includes notification library, gotifier, that will display notifications for using either Using terminal-notifier on OSX or notify-send on Ubuntu. Currently, only the push and test methods are displaying notifications.

limits

Limits will display limits information for your organization.

  • Max is the limit total for the organization
  • Remaining is the total number of calls or events left for the organization

The list is limited to those exposed by the REST API.

  force limits

Hacking

# set these environment variables in your startup scripts
export GOPATH=~/go
export PATH="$GOPATH/bin:$PATH"

# download the source and all dependencies
$ go get -u github.com/heroku/force
$ cd $GOPATH/src/github.com/heroku/force

# to compile and test modifications
$ go get .
$ force