-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User/salevy/autocomplete pr #325
base: master
Are you sure you want to change the base?
Changes from all commits
0f5e194
3fd57bb
af86259
bccb5f5
b104c1d
b764a46
e7d13e3
25c51f2
bd7c6ee
7a46a5d
71a02a5
ba78acb
a9e2b1c
5d9aa35
634a475
92cbc27
27976ff
f05da15
073093c
0500ad2
303a33e
dcca196
daf8fad
4b38e26
2f4764b
d763a21
8e65c51
fd5acde
5e3f9b4
5c7705d
0ebad86
c9bf57e
93d01b5
10f97d0
86345bc
2837659
5ef5ce6
704c656
d079e9e
8cbc7b2
830d077
dc5b79b
0c04901
a967b12
3530c82
77b727b
4cd34ef
2aef932
4fcaeee
bf234c5
948b189
5498a4e
8ea2fec
241cacd
17d95ff
01eed50
bd1197b
d168353
d05f59f
a760ff6
1645e05
0405335
a1452a8
44a7849
43de8fe
d17e3b9
b690d3d
c5816f1
4b02ea8
244a533
81db639
205b1cc
e1b89d9
3275781
4e0302c
7e8acfa
769759c
ee43779
5097ced
713aeee
a5a48f3
46e4f71
63b2f63
0328019
2f1f3c6
f77a279
bcdd787
111b99f
5a5a978
9317c74
13c0b0e
1a0e81f
1d29ef3
18957ff
528c566
50866fe
89b3f15
fe04ad8
acbd7c2
cba67b7
260884f
34048b5
efb8496
4647361
a7fad35
08875c7
8a9f9ea
a25165d
4603e6e
9cad3b7
7de0870
0c28c73
9c9d1c6
7bd5fa0
264dbf7
36c50f6
9e6f01d
f627297
7fa250d
0b15b61
04e181a
d34d519
0f7acf7
9eb7315
1187e46
8e865f3
5c43673
d8ab486
679b9d7
a329d8c
00a71e2
af42d62
e04fde2
f9acd0d
bd7bde4
3525aad
4e1fef8
999f8c4
90640f3
81c3f22
fb4d865
799a257
7140b21
b7361ef
9894c0d
c9706d5
4b7d077
bda4fa4
e69f87d
70f6bf5
58b6cd6
7aa2e79
ae41c42
a1f2712
7833a5a
4774603
516d039
2de14b3
c048afc
790e753
cd95986
cc4ba44
f9a7a8b
bf07014
a58f0b4
38c194f
44ab3a3
ee8db5f
17b8c31
ef91905
09731a5
fba57da
1ab193c
0e19e84
51e307f
ec91b36
7a60d3e
edc0c75
0f0114c
e90fcfb
58447de
ae9153b
c9227f0
ea19a5c
62748b0
085b029
63c425b
a9e37c7
15e2b67
23dcaf3
7d5fcdb
f4ed325
4cff492
0086ba4
4e39238
1556a70
151db33
c347c79
9c2eedf
aa0d8ee
8491d09
6131dbd
1322d36
c82ccbb
b9ef5a7
e6fbc36
6897548
ad765df
d3c8661
01add06
5fbf0d2
103955a
75f1cf6
a3b7e0c
ade8ce8
7f3b6a8
0a570c8
4061d6e
416b525
dbb6a3c
0813f4c
07d6fc6
17db794
01d25c3
8c75857
699d6e8
9fdc92c
cd62a31
97af7b1
cb25aa1
f27a28f
6bcddf0
2da0646
1160962
5108399
3743d39
d73f70d
b98f265
cfdf2e8
82769ca
38d1db5
5798df3
6bb1e21
27c9713
7df805c
902b84c
85e17e3
393cc15
72a233f
ab40daa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[Dolphin] | ||
HeaderColumnWidths=469,82,146 | ||
Timestamp=2016,7,15,0,17,26 | ||
Version=3 | ||
ViewMode=1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,18 @@ | |
> NOTE: If you are looking for the new Azure DevOps CLI, see [vsts-cli](https://github.com/microsoft/vsts-cli) | ||
|
||
[![NPM version](https://badge.fury.io/js/tfx-cli.svg)](http://badge.fury.io/js/tfx-cli) | ||
#### Internal Deploy / Pull Request validation | ||
[![build passing](https://shfeldma.visualstudio.com/_apis/public/build/definitions/f4b6db46-e446-49f0-a424-0bfb52c0925d/2/badge)](https://shfeldma.visualstudio.com/_apis/public/build/definitions/f4b6db46-e446-49f0-a424-0bfb52c0925d/2/badge) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like your personal org |
||
|
||
Command utility for interacting with Microsoft Team Foundation Server and Azure DevOps Services (formerly VSTS). It is cross platform and supported on Windows, OS X, and Linux. | ||
|
||
## Setup | ||
|
||
First, download and install [Node.js](http://nodejs.org) 4.0.x or later and NPM (included with the installer) | ||
First, download and install [Node.js](http://nodejs.org) 7.0.x or later and NPM (included with the installer or from sources) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Node 7 isn't a release supported by Node. Minimum would be an even number like 8 |
||
|
||
### Linux/OSX | ||
```bash | ||
sudo npm install -g tfx-cli | ||
sudo -E npm install -g tfx-cli | ||
``` | ||
|
||
### Windows | ||
|
@@ -38,6 +40,7 @@ tfx <command> --help | |
|
||
* `tfx build` ([builds](docs/builds.md)): Queue, view, and get details for builds | ||
* `tfx build tasks` ([build tasks](docs/buildtasks.md)): Create, list, upload and delete build tasks | ||
* `tfx build definition` ([build definition/definitions](docs/definitions.md)): Create, manage, show, list, export, upload and delete build definitions | ||
* `tfx extension` ([extensions](docs/extensions.md)): Package, manage, publisher Team Foundation Server / Azure DevOps extensions | ||
* `tfx workitem` ([work items](docs/workitems.md)): Create, query and view work items. | ||
|
||
|
@@ -126,3 +129,34 @@ We take contributions and fixes via Pull Request. [Read here](docs/contributions | |
## Code of Conduct | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
## Manual installation (from sources) | ||
* refer to installation for your OS (and follow the installation steps). | ||
* clone the repository. | ||
* to compile the sources run (see additional node modules): | ||
```bash | ||
npm update | ||
npm run build `(from the repository root)` | ||
``` | ||
`link the executable (and make executable)` | ||
### Linux (bash) | ||
```bash | ||
sudo ln -s <repository root>\app.js /usr/bin/tfx | ||
sudo chmod 755 /usr/bin/tfx | ||
``` | ||
### windows | ||
replace the content of `%appdata%\npm\tfx.cmd` with the following: | ||
```bash | ||
@IF EXIST "%~dp0\node.exe" ( | ||
"%~dp0\node.exe" "%~dp0\node_modules\tfx-cli\_build\app.js" %* | ||
) ELSE ( | ||
@SETLOCAL | ||
@SET PATHEXT=%PATHEXT:;.JS;=;% | ||
node "%~dp0\node_modules\tfx-cli\_build\app.js" %* | ||
) | ||
``` | ||
### additional node modules | ||
`run "npm outdated / update" to resolve modules dependecy or install the following modules (this may need to happen befor compilation)` | ||
```bash | ||
npm install archiver colors graceful-fs gulp-filter gulp-mocha gulp-tsb gulp-util is-utf8 pug jszip node-uuid prompt q readable-stream ts-promise typescript unique-stream user-home validator azure-devops-node-api xml2js del os-homedir copy-paste shelljs lodash [email protected] pretty-hrtime liftoff tildify interpret v8flags minimist onecolor winreg glob json-in-place mkdirp | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TS files aren't directly executable by Node |
||
import command = require("./lib/command"); | ||
import common = require("./lib/common"); | ||
import errHandler = require("./lib/errorhandler"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { TfCommand, CoreArguments } from "../../../lib/tfcommand"; | ||
import args = require("../../../lib/arguments"); | ||
import buildBase = require("../default"); | ||
|
||
export interface AgentArguments extends buildBase.BuildArguments { | ||
agentId: args.IntArgument; | ||
agentName: args.StringArgument; | ||
poolId: args.IntArgument; | ||
userCapabilityKey: args.StringArgument; | ||
userCapabilityValue: args.StringArgument; | ||
disable: args.StringArgument; | ||
deleteAgent: args.StringArgument; | ||
parallel: args.IntArgument; | ||
waitForInProgressRequests: args.StringArgument; | ||
} | ||
|
||
export function getCommand(args: string[]): AgentBase<void> { | ||
return new AgentBase<void>(args); | ||
} | ||
|
||
export class AgentBase<T> extends buildBase.BuildBase<AgentArguments, T> { | ||
protected description = "Commands for managing Agents."; | ||
protected serverCommand = false; | ||
protected setCommandArgs(): void { | ||
super.setCommandArgs(); | ||
this.registerCommandArgument("agentId", "Agent ID", "Identifies a particular Agent.", args.IntArgument,null); | ||
this.registerCommandArgument("agentName", "Agent Name", "Required Agent Name.", args.StringArgument, null); | ||
this.registerCommandArgument("poolId", "Agent Pool Id", "Required Agent pool ID For Edit.", args.IntArgument, null); | ||
this.registerCommandArgument("userCapabilityKey", "Capability to add / edit", "Capability to add / edit to the Agent.", args.StringArgument, null); | ||
this.registerCommandArgument("userCapabilityValue", "Value to add / edit", "Value to add / edit to the Agent User Capabilities.", args.StringArgument, null); | ||
this.registerCommandArgument("disable", "disable / enable agent", "Update the agent status.", args.StringArgument, null); | ||
this.registerCommandArgument("deleteAgent", "deleteagent", "Delete an agent.", args.StringArgument, null); | ||
this.registerCommandArgument("parallel", "max agent parallelism", "Maximum parallel agent runs.", args.IntArgument, null); | ||
this.registerCommandArgument("waitForInProgressRequests", "Wait For Active Requests", "Waiting for active Agent jobs / requests", args.StringArgument, null); | ||
} | ||
public exec(cmd?: any): Promise<any> { | ||
return this.getHelp(cmd); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { TfCommand } from "../../../lib/tfcommand"; | ||
import args = require("../../../lib/arguments"); | ||
import agentBase = require("./default"); | ||
import agentClient = require("azure-devops-node-api/TaskAgentApiBase"); | ||
import trace = require("../../../lib/trace"); | ||
import taskAgentContracts = require("azure-devops-node-api/interfaces/TaskAgentInterfaces"); | ||
|
||
export function describe(): string { | ||
return "Delete an Agent"; | ||
} | ||
|
||
export function getCommand(args: string[]): AgentDelete { | ||
return new AgentDelete(args); | ||
} | ||
|
||
export class AgentDelete extends agentBase.AgentBase<taskAgentContracts.TaskAgent> { | ||
protected serverCommand = true; | ||
protected description = "Delete a Agent."; | ||
protected getHelpArgs(): string[] { | ||
return ["poolId", "agentId", "agentName", "deleteAgent"]; | ||
} | ||
|
||
|
||
public exec(): Promise<void | taskAgentContracts.TaskAgent> { | ||
trace.debug("delete-agents.exec"); | ||
if (this.connection.getCollectionUrl().includes("DefaultCollection")) { | ||
var agentapi = this.webApi.getTaskAgentApi(this.connection.getCollectionUrl().substring(0, this.connection.getCollectionUrl().lastIndexOf("/"))); | ||
} else { | ||
var agentapi = this.webApi.getTaskAgentApi(this.connection.getCollectionUrl()); | ||
} | ||
|
||
return Promise.all<number | string>([ | ||
this.commandArgs.poolId.val(), | ||
this.commandArgs.agentId.val(), | ||
this.commandArgs.agentName.val(), | ||
this.commandArgs.deleteAgent.val() | ||
]).then((values) => { | ||
const [poolId, agentid, agentname, deleteAgent] = values; | ||
var agents: number[] = null; | ||
trace.debug("getting pool (id) : %s", poolId); | ||
trace.debug("getting agent (id) : %s", agentid); | ||
trace.debug("getting agent (name) : %s", agentname); | ||
trace.info("Deleting Agent..."); | ||
if (agentid) { | ||
agents = [agentid as number]; | ||
} | ||
else if (agentname) { | ||
trace.debug("No agent Id provided, checking for agent with name " + agentname); | ||
return agentapi.then((api) => { api.getAgents(poolId as number, agentname as string).then((ao: taskAgentContracts.TaskAgent[]) => { | ||
if (ao.length > 0) { | ||
var aid = ao[0].id; | ||
var an = ao[0].name; | ||
trace.debug("found, agent id %s for agent name %s", aid, an); | ||
return this._deleteAgent(agentapi, poolId as number, agentid as number, deleteAgent as string); | ||
} | ||
else { | ||
trace.debug("No agents found with name " + agentname); | ||
throw new Error("No agents found with name " + agentname); | ||
|
||
} | ||
}); | ||
}); | ||
} | ||
|
||
trace.debug("deleting agent: %s", agentname); | ||
return this._deleteAgent(agentapi, poolId as number, agentid as number, deleteAgent as string); | ||
}); | ||
} | ||
|
||
public friendlyOutput(agent: taskAgentContracts.TaskAgent): void { | ||
trace.println(); | ||
trace.success('Agent %s deleted successfully!', agent.name); | ||
} | ||
|
||
private _deleteAgent(agentapi, pool: number, agentid: number, deleteAgent: string) { | ||
return agentapi.getAgent(pool, agentid, true, true, null).then((agent) => { | ||
trace.debug("deleting Agent: %s", deleteAgent); | ||
|
||
if (deleteAgent) { | ||
if (deleteAgent == "true") { | ||
return agentapi.deleteAgent(pool, agentid).then(() => { | ||
trace.debug("agent set for deletion : %s"); | ||
agent.id = null; | ||
return agent; | ||
}) | ||
} | ||
if (deleteAgent != "true") { | ||
trace.error("allowed value is [true] only!") | ||
} | ||
} | ||
}); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { TfCommand } from "../../../lib/tfcommand"; | ||
import args = require("../../../lib/arguments"); | ||
import agentBase = require("./default"); | ||
import agentClient = require("azure-devops-node-api/TaskAgentApiBase"); | ||
import trace = require("../../../lib/trace"); | ||
import taskAgentContracts = require("azure-devops-node-api/interfaces/TaskAgentInterfaces"); | ||
|
||
export function getCommand(args: string[]): AgentDetails { | ||
return new AgentDetails(args); | ||
} | ||
|
||
export class AgentDetails extends agentBase.AgentBase<taskAgentContracts.TaskAgent> { | ||
protected serverCommand = true; | ||
protected description = "Display extended Agent details."; | ||
protected getHelpArgs(): string[] { | ||
return ["project", "poolId"]; | ||
} | ||
|
||
public exec(): Promise<taskAgentContracts.TaskAgent[]> { | ||
trace.debug("list-agents.exec"); | ||
if (this.connection.getCollectionUrl().includes("DefaultCollection")) { | ||
var agentapi = this.webApi.getTaskAgentApi(this.connection.getCollectionUrl().substring(0, this.connection.getCollectionUrl().lastIndexOf("/"))); | ||
} else { | ||
var agentapi = this.webApi.getTaskAgentApi(this.connection.getCollectionUrl()); | ||
} | ||
return this.commandArgs.poolId.val().then((pool) => { | ||
trace.debug("getting pool : %s", pool); | ||
return agentapi.then((api) => { return api.getAgents(pool); | ||
}); | ||
}); | ||
} | ||
|
||
public friendlyOutput(agents: taskAgentContracts.TaskAgent[]): void { | ||
if (!agents) { | ||
throw new Error("pool not supplied or not found"); | ||
} | ||
trace.info("Agents in pool:") | ||
trace.println(); | ||
agents.forEach((agent) => { | ||
trace.info(" %s (%s) : %s ", agent.id, agent.version, agent.name); | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?