<commit_before># digitalocean-cli
NodeJS CLI for [DigitalOcean]([https://www.digitalocean.com)

Written in CoffeeScript, based on [do-wrapper](https://www.npmjs.com/package/do-wrapper) npm package

### install

```
npm install -g digitalocean-cli
```

This will add a ```do-cli``` mapping (symlinked into ./do-cli.cofffe),
which can be used like this ```do-cli.coffee {command}```

See list of commands bellow, or just execute

```
do-cli -h
```


### install from source

```
git clone <EMAIL>:o2platform/digitalocean-cli.git
cd digitalocean-cli
npm install
```

After install you can use ```./do-cli.coffee {command}```

### configure

You will need to set the DigitalOcean API Key, for example in OSX you can use:

```
export api_key={key}
```


### commands

#### -h

Shows the commands availabe: ```do-cli -h```

### list

Gets list of droplets. Here is the info provided after executing ```./do-cli list```

```
id | name | status | region | locked | ip
5467866 | test-docker |  active | lon1 | false | 172.16.58.3
```

If this box was setup with an ssh key that currently exists on the local box,
you can connect to it using:

```ssh root@{ip}``` which in the example above is ```ssh root@172.16.58.3```

Note: if you are creating and deleting images regularly, digitalocean tends to reuse the IPs,
which means that you will see an ```WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!``` error
(with ssh failing to connect)

One way to deal with this is to use the command ```ssh-keygen -R {ip}``` (in this case ```ssh-keygen -R 172.16.58.3```).
After that, the ```ssh root@{ip}`` will work

#### info {id}

Gets droplet information: ```./do-cli info {id}```

#### create

Creates a new droplet, using these values

```coffee
configuration =
  "name": "new-droplet",
  "region": "lon1",
  "size": "512mb",
  "image": "ubuntu-14-04-x64",
  "ssh_keys": ['<KEY>'],
  "backups": false,
  "ipv6": true,
  "user_data": user_data,
  "private_networking": null
```

```
./do-cli create
```

#### delete {id}

Delete Droplet with <id>: ```./do-cli delete {id}```


#### Delete-all

Deletes all droplets: ```./do-cli delete-all```


#### repl

Starts a javascript repl with the ```that``` variable set to the
```do-wrapper``` api. For example, here is how the ```dropletsGetAll``` is invoked

```
[fluentnode] repl> that.dropletsGetAll({}, function (err, res, body) { console.log(body)})
```

### issues/bugs

If you have a problem or idea for new feature please [open an issue for it](https://github.com/o2platform/digitalocean-cli/issues)<commit_msg>updating README.md<commit_after># digitalocean-cli
NodeJS CLI for [DigitalOcean]([https://www.digitalocean.com)

Written in CoffeeScript, based on [do-wrapper](https://www.npmjs.com/package/do-wrapper) npm package

## Install

```
npm install -g digitalocean-cli
```

This will add a ```do-cli``` mapping (symlinked into ./do-cli.cofffe),
which can be used like this ```do-cli.coffee {command}```

See list of commands bellow, or just execute

```
do-cli -h
```


## Install from source

```
git clone <EMAIL>:o2platform/digitalocean-cli.git
cd digitalocean-cli
npm install
```

After install you can use ```./do-cli.coffee {command}```

## Configure

You will need to set the DigitalOcean API Key, for example in OSX you can use:

```
export api_key={key}
```


## Commands

#### -h

Shows the commands availabe: ```do-cli -h```

### list

Gets list of droplets. Here is the info provided after executing ```./do-cli list```

```
id | name | status | region | locked | ip
5467866 | test-docker |  active | lon1 | false | 172.16.58.3
```

If this box was setup with an ssh key that currently exists on the local box,
you can connect to it using:

```ssh root@{ip}``` which in the example above is ```ssh root@172.16.58.3```

Note: if you are creating and deleting images regularly, digitalocean tends to reuse the IPs,
which means that you will see an ```WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!``` error
(with ssh failing to connect)

One way to deal with this is to use the command ```ssh-keygen -R {ip}``` (in this case ```ssh-keygen -R 172.16.58.3```).
After that, the ```ssh root@{ip}`` will work

#### info {id}

Gets droplet information: ```./do-cli info {id}```

#### create

Creates a new droplet, using these values

```coffee
configuration =
  "name": "new-droplet",
  "region": "lon1",
  "size": "512mb",
  "image": "ubuntu-14-04-x64",
  "ssh_keys": ['0d:53:e1:59:9f:f1:41:26:a8:a7:ac:9f:d3:90:45:c8'],
  "backups": false,
  "ipv6": true,
  "user_data": user_data,
  "private_networking": null
```

```
./do-cli create
```

#### delete {id}

Delete Droplet with <id>: ```./do-cli delete {id}```


#### Delete-all

Deletes all droplets: ```./do-cli delete-all```


#### repl

Starts a javascript repl with the ```that``` variable set to the
```do-wrapper``` api. For example, here is how the ```dropletsGetAll``` is invoked

```
[fluentnode] repl> that.dropletsGetAll({}, function (err, res, body) { console.log(body)})
```

## Issues/bugs

If you have a problem or idea for new feature please [open an issue for it](https://github.com/o2platform/digitalocean-cli/issues)
{'fraction_non_alphanumeric': 0.1671856753600623, 'fraction_numerical': 0.021603736862592447, 'mean_word_length': 4.206686930091186, 'pattern_counts': {'":': 18, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1385183', 'n_tokens_mistral': 1918, 'n_tokens_neox': 1737, 'n_words': 620}