Skip to content

sjmtan/circleci-cli

Repository files navigation

circleci-cli

This project is the seed for CircleCI's new command-line application.

Getting Started

1. Get the latest binary

Download the latest release from GitHub for your operating system. If you're on a Mac, this would be circleci-cli_0.1.X_darwin_amd64.tar.gz.

2. Put the binary in your $PATH

$ tar -xvzf circleci-cli_0.1.X_darwin_amd64.tar.gz
$ mv circleci-beta /usr/local/bin

3. Run a Diagnostic check

$ circleci-beta diagnostic

Please enter your CircleCI API token:
OK.
Your configuration has been created in `/home/zzak/.circleci/cli.yml`.
It can edited manually for advanced settings.

---
CircleCI CLI Diagnostics
---

Config found: `/home/zzak/.circleci/cli.yml`
Host is: https://circleci.com
OK, got a token.

Running a query

After you've setup the CLI, you can try executing a GraphQL query against the client.

Given we've written the following query in a file called query.gql:

query IntrospectionQuery {
	__schema {
		queryType { name }
		mutationType { name }
		subscriptionType { name }
		types {
			...FullType
		}
		directives {
			name
			description
		}
	}
}

fragment FullType on __Type {
	kind
	name
	description
	fields(includeDeprecated: true) {
		name
	}
}

You can now pipe that file to the query command to send it.

$ cat query.gql | circleci-beta query

This should pretty-print back a JSON response from the server:

{
	"__schema": {
		# ...Tons O' Schema
	}
}

About

Use CircleCI from the command line

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.7%
  • Shell 2.0%
  • Other 0.3%