Command-line Syntax (Team Explorer Everywhere)
This topic provides general syntax and usage information for the Cross-platform Command-Line Client for Team Foundation Server.
In this topic
Specifying Options
Absolute paths on a computer that is running Unix always start with a forward slash, so you must use hyphens to start options. If you do not do this, the Cross-platform Command-Line Client for Team Foundation Server cannot tell a path from an option. The examples shown in the documentation for the command-line client for Visual Studio use a slash to denote options, but for the commands that are common to both clients, you must instead use the hyphen (-).
Quoting and Escaping
You must escape or quote arguments to commands if those arguments contain characters that your shell considers special. On Windows operating systems, you typically need to enclose arguments in quotation marks (“”) only if those arguments contains spaces. Unix shells have additional requirements.
Unix Shells
Unix shells support many special characters for wildcards, regular expressions and so on. You can mark literal text in Unix shells by using the following three methods:
Precede a character with a backslash (\) to preserve the literal value of the character.
Enclose text within single quotation marks (‘’) to preserve the literal values of the enclosed characters.
Shell variables that are referenced with a dollar sign ($) and wildcards are not expanded if they are enclosed within single quotation marks.
Enclose text within double quotation marks (“”) to preserve the literal value of the enclosed characters with the exception of $, `, \, and !.
Because of these exceptions, variables are expanded, subshells are still evaluated, the backslash can still be used to escape characters, and history events are still expanded.
Note
Server paths for Visual Studio Team Foundation Server start with a dollar sign, but Unix shells use the dollar sign to start variable expansion. Shells like sh, ksh, bash, and zah recognize that the character in a server path that occurs after the dollar sign is not a valid variable name. Therefore, these shells pass the dollar sign to the Cross-platform Command-Line Client for Team Foundation Server unaltered.
However, shells derived from csh (including tcsh) do not parse the command line in this manner. These shells read the dollar sign and attempt to substitute a variable that matches the text that follows. Because the text that follows is a slash (/), and these shells require variable names to start with a letter, an error appears. If you use the csh or tcsh shells, you must escape the dollar signs in server paths by using a backslash or single quotation marks.
Examples
The following example demonstrates how to enclose paths that contain whitespace on a computer that is running Windows.
tf checkout -recursive “$/Inventory/Client Suite/”
The following example demonstrates how to use the backslash to escape a single character on a computer that is running Unix.
tf checkout -recursive $/Inventory/Client\ Suite/
The following example demonstrates how to use single quotation marks to enclose a path on a computer that is running Unix.
tf checkout -recursive ‘$/Inventory/Client Suite/’
The following example demonstrates how to use double quotation marks to enclose a path on a computer that is running Unix.
tf checkin -comment:”Fixed the bug\!” file.java
The following example demonstrates how to use backslash to escape dollar signs in the path when using the csh or tcsh shell on a computer that is running Unix.
tf checkout -recursive \$/Inventory/Client\ Suite/
The following example demonstrates how to use single quotation marks to enclose dollar signs in the path when using the csh or tcsh shell on a computer that is running Unix.
tf checkout -recursive ‘$/Inventory/Client Suite/’
The following example demonstrates how to use double quotation marks to enclose dollar signs in the path when using the csh or tcsh shell on a computer that is running Unix.
tf checkout -recursive \$”/Inventory/Client Suite/”
Item Specifications
An item specification is a local or server path that describes a file or folder that is an input parameter to an option or command for the Cross-platform Command-Line Client for Team Foundation Server. An item specification might contain a version specification suffix, separated by a semicolon. This suffix is optional. Specify the suffix only when you want to refer to a historic version of an item.
Example item specifications:
Item specification |
Description |
---|---|
$/Inventory/src |
Server path to a folder |
$/Inventory/src/Class.java |
Server path to a file |
/tmp/Inventory |
Local path (Unix) to a working folder |
/tmp/Inventory/src/Class.java |
Local path (Unix) to a file |
C:\Inventory\src |
Local path (Windows) to a working folder |
C:\Inventory\src\Class.java |
Local path (Windows) to a file |
$/Inventory/src;C4095 |
Server path to a folder at changeset 4095 |
.\Class.java;C129 |
Relative local path (Windows) to a file at changeset 129 |
./Class.java;Lrelease-1.0 |
Relative local path (Unix) to a file at label release-1.0 |
$/Inventory/src/file.txt;Wdev;john |
Server path at the version in the dev workspace that is owned by John. |
file.txt;D01/01/2007 |
Local path at January 1, 2007 |
file.txt;X1067 |
Previously deleted file with deletionID 1067 |
Version Specifications
A version specification is a specially formatted string that refers to a specific single version or a range of versions of an item in version control. Version specifications are used in two ways: as suffixes to item specifications (for more information, see Item Specifications earlier in this topic) and as stand-alone values to the /version option for certain commands.
Example version specifications:
Version Specification Format |
Description |
---|---|
T |
The latest version. |
Cn |
The version at changeset n. |
LlabelID |
The version at label labelID. |
Wname; owner |
The version currently in workspace name owned by owner. |
Ddatestring |
The version at the date and time specified in datestring |
XdeletionID |
The version that was deleted and given the deletionID by the server. |