UNPKG

1.64 kBJavaScriptView Raw
1//
2// Copyright (c) Microsoft and contributors. All rights reserved.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17var AutoComplete = require('../lib/autocomplete');
18//load the autocomplete, so that rest code in the file will not execute
19//till the command gets committed. This gets autocomplete faster
20new AutoComplete();
21
22var AzureCli = require('../lib/cli');
23var Constants = require('../lib/util/constants');
24var utilsCore = require('../lib/util/utilsCore');
25var TelemetryClient = require('../lib/util/telemetry');
26
27utilsCore.isTelemetryEnabled(function (err, isEnabled) {
28 // err will always be null
29 TelemetryClient.init(isEnabled);
30 if (isEnabled) {
31 TelemetryClient.start(process.argv);
32 }
33
34 if (process.argv[2] !== '--gen') {
35 cli = new AzureCli();
36 cli.parse(process.argv);
37 if (cli.args.length === 0) {
38 cli.parse(['', '', '-h']);
39 }
40 } else {
41 if (process.argv[3]) {
42 cli = new AzureCli(null, null, process.argv[3]);
43 } else {
44 cli = new AzureCli(null, null, Constants.API_VERSIONS.ARM);
45 cli = new AzureCli(null, null, Constants.API_VERSIONS.ASM);
46 }
47 }
48});