<commit_before>// 
// Copyright (c) Microsoft and contributors.  All rights reserved.
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

var utils = require('../../util/utils');
var image = require('./iaas/image');
var $ = utils.getLocaleString;

var VMClient = require('./vm/vmclient');

exports.init = function (cli) {
  var vm = cli.category('vm')
      .description($('Commands to manage your Virtual Machines'));

  var logger = cli.output;

  vm.command('create <dns-name> <image> <user-name> [password]')
      .usage('[options] <dns-name> <image> <user-name> [password]')
      .description($('Create a VM'))
      .option('-o, --community', $('the <image> is a community image'))
      .option('-c, --connect', $('connect to existing VMs'))
      .option('-l, --location <name>', $('the location'))
      .option('-a, --affinity-group <name>', $('the affinity group'))
      .option('-u, --blob-url <url>', $('the blob url for OS disk'))
      .option('-z, --vm-size <size>', $('the virtual machine size [small]\n    extrasmall, small, medium, large, extralarge, a5, a6, a7'))
      .option('-n, --vm-name <name>', $('the virtual machine name'))
      .option('-e, --ssh [port]', $('the ssh port to enable [22]'))
      .option('-t, --ssh-cert <pem-file|fingerprint>', $('the SSH certificate'))
      .option('-P, --no-ssh-password', $('indicates that the password should be removed when using --ssh-cert'))
      .option('-r, --rdp [port]', $('indicates that RDP should be enabled [3389]'))
      .option('-w, --virtual-network-name <name>', $('the virtual network name'))
      .option('-b, --subnet-names <list>', $('the comma-delimited subnet names'))
      .option('-A, --availability-set <name>', $('the name of availability set to create or use'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .option('-d, --custom-data <custom-data-file>', $('CustomData file'))
      .execute(function (dnsName, imageName, userName, password, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.createVM(dnsName, imageName, userName, password, options, callback, logger);
      });

  vm.command('create-from <dns-name> <role-file>')
      .usage('[options] <dns-name> <role-file>')
      .description($('Create a VM from json role file'))
      .option('-c, --connect', $('connect to existing VMs'))
      .option('-l, --location <name>', $('the location'))
      .option('-a, --affinity-group <name>', $('the affinity group'))
      .option('-t, --ssh-cert <pem-file>', $('Upload SSH certificate'))
      .option('-w, --virtual-network-name <name>', $('the virtual network name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (dnsName, roleFile, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.createVMfromJson(dnsName, roleFile, options, callback, logger);
      });

  vm.command('list')
      .description($('List the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.listVMs(options, callback, logger);
      });

  vm.command('show <name>')
      .description($('Show details about the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.showVM(name, options, callback, logger);
      });

  vm.command('delete <name>')
      .description($('Delete the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-b, --blob-delete', $('Remove image and disk blobs'))
      .option('-q, --quiet', $('quiet mode, do not ask for delete confirmation'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (vmName, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.deleteVM(vmName, options, callback, logger);
      });

  vm.command('start <name>')
      .description($('Start the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.startVM(name, options, callback, logger);
      });

  vm.command('restart <name>')
      .description($('Restart the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.restartVM(name, options, callback, logger);
      });

  vm.command('shutdown <name>')
      .description($('Shutdown the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-p, --stay-provisioned', $('if specified the compute resource will not be released on shutdown'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.shutdownVM(name, options, callback, logger);
      });

  vm.command('capture <vm-name> <target-image-name>')
      .description($('Capture the VM image'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-e, --label <label>', $('Target image friendly name'))
      .option('-t, --delete', $('Delete virtual machine after successful capture'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (vmName, targetImageName, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.captureVM(vmName, targetImageName, options, callback, logger);
      });

  vm.command('export <vm-name> <file-path>')
      .description($('Export a VM to a file'))
      .option('-d, --dns-name <name>', $('Export the virtual machine for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (vmName, filePath, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.exportVM(vmName, filePath, options, callback, logger);
      });

   var docker = vm.category('docker')
      .description($('Commands to manage your Docker Virtual Machine')); 

   docker.command('create <dns-name> <image> <user-name> [password]')
      .usage('[options] <dns-name> <image> <user-name> [password]')
      .description($('Create a VM'))
      .option('-dp, --docker-port [port]', $('Port to use for docker [4243]'))
      .option('-dc, --docker-cert-dir [dir]', $('Directory containing docker certs [.docker/]'))
      .option('-c, --connect', $('connect to existing VMs'))
      .option('-l, --location <name>', $('the location'))
      .option('-a, --affinity-group <name>', $('the affinity group'))
      .option('-u, --blob-url <url>', $('the blob url for OS disk'))
      .option('-z, --vm-size <size>', $('the virtual machine size [small]\n    extrasmall, small, medium, large, extralarge, a5, a6, a7'))
      .option('-n, --vm-name <name>', $('the virtual machine name'))
      .option('-e, --ssh [port]', $('the ssh port to enable [22]'))
      .option('-t, --ssh-cert <pem-file|fingerprint>', $('the SSH certificate'))
      .option('-P, --no-ssh-password', $('indicates that the password should be removed when using --ssh-cert'))
      .option('-w, --virtual-network-name <name>', $('the virtual network name'))
      .option('-b, --subnet-names <list>', $('the comma-delimited subnet names'))
      .option('-A, --availability-set <name>', $('the name of availability set to create or use'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .option('-d, --custom-data <custom-data-file>', $('CustomData file'))
      .execute(function (dnsName, imageName, userName, password, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.createDockerVM(dnsName, imageName, userName, password, options, callback, logger);
      });  

  var location = vm.category('location')
      .description($('Commands to manage your Virtual Machine locations'));

  location.command('list')
      .description($('List locations available for your account'))<commit_msg>Fix vm docker create invalid flags<commit_after>// 
// Copyright (c) Microsoft and contributors.  All rights reserved.
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

var utils = require('../../util/utils');
var image = require('./iaas/image');
var $ = utils.getLocaleString;

var VMClient = require('./vm/vmclient');

exports.init = function (cli) {
  var vm = cli.category('vm')
      .description($('Commands to manage your Virtual Machines'));

  var logger = cli.output;

  vm.command('create <dns-name> <image> <user-name> [password]')
      .usage('[options] <dns-name> <image> <user-name> [password]')
      .description($('Create a VM'))
      .option('-o, --community', $('the <image> is a community image'))
      .option('-c, --connect', $('connect to existing VMs'))
      .option('-l, --location <name>', $('the location'))
      .option('-a, --affinity-group <name>', $('the affinity group'))
      .option('-u, --blob-url <url>', $('the blob url for OS disk'))
      .option('-z, --vm-size <size>', $('the virtual machine size [small]\n    extrasmall, small, medium, large, extralarge, a5, a6, a7'))
      .option('-n, --vm-name <name>', $('the virtual machine name'))
      .option('-e, --ssh [port]', $('the ssh port to enable [22]'))
      .option('-t, --ssh-cert <pem-file|fingerprint>', $('the SSH certificate'))
      .option('-P, --no-ssh-password', $('indicates that the password should be removed when using --ssh-cert'))
      .option('-r, --rdp [port]', $('indicates that RDP should be enabled [3389]'))
      .option('-w, --virtual-network-name <name>', $('the virtual network name'))
      .option('-b, --subnet-names <list>', $('the comma-delimited subnet names'))
      .option('-A, --availability-set <name>', $('the name of availability set to create or use'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .option('-d, --custom-data <custom-data-file>', $('CustomData file'))
      .execute(function (dnsName, imageName, userName, password, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.createVM(dnsName, imageName, userName, password, options, callback, logger);
      });

  vm.command('create-from <dns-name> <role-file>')
      .usage('[options] <dns-name> <role-file>')
      .description($('Create a VM from json role file'))
      .option('-c, --connect', $('connect to existing VMs'))
      .option('-l, --location <name>', $('the location'))
      .option('-a, --affinity-group <name>', $('the affinity group'))
      .option('-t, --ssh-cert <pem-file>', $('Upload SSH certificate'))
      .option('-w, --virtual-network-name <name>', $('the virtual network name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (dnsName, roleFile, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.createVMfromJson(dnsName, roleFile, options, callback, logger);
      });

  vm.command('list')
      .description($('List the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.listVMs(options, callback, logger);
      });

  vm.command('show <name>')
      .description($('Show details about the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.showVM(name, options, callback, logger);
      });

  vm.command('delete <name>')
      .description($('Delete the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-b, --blob-delete', $('Remove image and disk blobs'))
      .option('-q, --quiet', $('quiet mode, do not ask for delete confirmation'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (vmName, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.deleteVM(vmName, options, callback, logger);
      });

  vm.command('start <name>')
      .description($('Start the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.startVM(name, options, callback, logger);
      });

  vm.command('restart <name>')
      .description($('Restart the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.restartVM(name, options, callback, logger);
      });

  vm.command('shutdown <name>')
      .description($('Shutdown the VM'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-p, --stay-provisioned', $('if specified the compute resource will not be released on shutdown'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (name, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.shutdownVM(name, options, callback, logger);
      });

  vm.command('capture <vm-name> <target-image-name>')
      .description($('Capture the VM image'))
      .option('-d, --dns-name <name>', $('only show VMs for this DNS name'))
      .option('-e, --label <label>', $('Target image friendly name'))
      .option('-t, --delete', $('Delete virtual machine after successful capture'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (vmName, targetImageName, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.captureVM(vmName, targetImageName, options, callback, logger);
      });

  vm.command('export <vm-name> <file-path>')
      .description($('Export a VM to a file'))
      .option('-d, --dns-name <name>', $('Export the virtual machine for this DNS name'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .execute(function (vmName, filePath, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.exportVM(vmName, filePath, options, callback, logger);
      });

   var docker = vm.category('docker')
      .description($('Commands to manage your Docker Virtual Machine')); 

   docker.command('create <dns-name> <image> <user-name> [password]')
      .usage('[options] <dns-name> <image> <user-name> [password]')
      .description($('Create a VM'))
      .option('-p, --docker-port [port]', $('Port to use for docker [4243]'))
      .option('-C, --docker-cert-dir [dir]', $('Directory containing docker certs [.docker/]'))
      .option('-c, --connect', $('connect to existing VMs'))
      .option('-l, --location <name>', $('the location'))
      .option('-a, --affinity-group <name>', $('the affinity group'))
      .option('-u, --blob-url <url>', $('the blob url for OS disk'))
      .option('-z, --vm-size <size>', $('the virtual machine size [small]\n    extrasmall, small, medium, large, extralarge, a5, a6, a7'))
      .option('-n, --vm-name <name>', $('the virtual machine name'))
      .option('-e, --ssh [port]', $('the ssh port to enable [22]'))
      .option('-t, --ssh-cert <pem-file|fingerprint>', $('the SSH certificate'))
      .option('-P, --no-ssh-password', $('indicates that the password should be removed when using --ssh-cert'))
      .option('-w, --virtual-network-name <name>', $('the virtual network name'))
      .option('-b, --subnet-names <list>', $('the comma-delimited subnet names'))
      .option('-A, --availability-set <name>', $('the name of availability set to create or use'))
      .option('-s, --subscription <id>', $('the subscription id'))
      .option('-d, --custom-data <custom-data-file>', $('CustomData file'))
      .execute(function (dnsName, imageName, userName, password, options, callback) {
        var vmClient = new VMClient(cli, options.subscription);
        vmClient.createDockerVM(dnsName, imageName, userName, password, options, callback, logger);
      });  

  var location = vm.category('location')
      .description($('Commands to manage your Virtual Machine locations'));

  location.command('list')
      .description($('List locations available for your account'))
{'fraction_non_alphanumeric': 0.1878797655535839, 'fraction_numerical': 0.0023659730063988814, 'mean_word_length': 3.2364464692482917, 'pattern_counts': {'":': 0, '<': 143, '<?xml version=': 0, '>': 143, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, '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': '5735661', 'n_tokens_mistral': 5639, 'n_tokens_neox': 5521, 'n_words': 1716}