Formatting usage examples

The examples in this topic are not tied to specific commands.

The data describes the objects and properties used as output in the examples. In the following example, the data is organized into four columns: displayname, task_synopsis, owner, and release.

101  Fix defect M#1234                  fred   1.0
102  Implement sorting                  joe    1.0
900  Fix defect M#12345                 susan  1.0
901  Implement date formatting          john   1.0_patch
1000 Fix defect M#1357                  fred   1.1
1001 Fix defect M#6523                  fred   1.1
1002 Implement new property formats     susan  2.0
1003 Add grouping and extending sorting joe    2.0
1004 Fix defect J#1234                  susan  1.1
1005 Extend grouping feature            john   2.0
In the following example, the data is not numbered (-u) and is not sorted (-nosort), so that the output displays in the original order of the data. The -format values organize the data into four columns: displayname, task_synopsis, owner, and release. The columns are aligned because -noformat was not used.
-u -nosort -format "%displayname %task_synopsis %owner %release"

101  Fix defect M#1234                  fred   1.0
102  Implement sorting                  joe    1.0
900  Fix defect M#12345                 susan  1.0
901  Implement date formatting          john   1.0_patch
1000 Fix defect M#1357                  fred   1.1
1001 Fix defect M#6523                  fred   1.1
1002 Implement new property formats     susan  2.0
1003 Add grouping and extending sorting joe    2.0
1004 Fix defect J#1234                  susan  1.1
1005 Extend grouping feature            john   2.0
The following example shows the output numbered by default. The example also shows this information:
  • The format string defines two columns: displayname and task_synopsis.
  • Grouping uses a format that references the owner property.
  • Sorting is ascending on the release value. The release value is not displayed in the output, but is used only to sort. The sort order uses owner as the ascending primary key (grouping takes precedence), and release as the ascending secondary key.
  • Objects with the same owner value are grouped together under the same grouping header.
  • Column headers are displayed.
-format "%displayname %task_synopsis" -groupby "Owner: %owner" -sortby +release -column_headers

Owner: fred 
1) 101   Fix defect M#1234 
2) 1000  Fix defect M#1357 
3) 1001  Fix defect M#6523

Owner: joe 
4) 102   Implement sorting
5) 1003  Add grouping and extending sorting

Owner: john 
6) 901   Implement date formatting
7) 1005  Extend grouping feature

Owner: susan
8) 900   Fix defect M#12345
9) 1004  Fix defect J#1234
10)1002  Implement new property formats
The following example shows output numbered by default. The format string defines three columns: displayname, task_synopsis, and release. The task_synopsis values are truncated after 20 characters. Sorting is ascending on owner, which is not a displayed property, and then release.
-format "%displayname %{task_synopsis[truncate=20]} %release"
-sortby +owner+release

1) 101   Fix defect M#1234     1.0
2) 1000  Fix defect M#1357     1.1
3) 1001  Fix defect M#6523     1.1 
4) 102   Implement sorting     1.0 
5) 1003  Add grouping and ...  2.0 
6) 901   Implement date fo...  1.0_patch 
7) 1005  Extend grouping f...  2.0 
8) 900   Fix defect M#12345    1.0 
9) 1004  Fix defect J#1234     1.1 
10)1002  Implement new pro...  2.0
If you want to wrap the text after 20 characters rather than truncating it, you can substitute wrap=20 for truncate=20, and the output will look like the following output:
1) 101   Fix defect M#1234        1.0
2) 1000  Fix defect M#1357        1.1 
3) 1001  Fix defect M#6523        1.1 
4) 102   Implement sorting        1.0 
5) 1003  Add grouping and ext     2.0 
         ending sorting
6) 901   Implement date forma     1.0_patch
         tting 
7) 1005  Extend grouping feat     2.0 
         ure
8) 900   Fix defect M#12345       1.0 
9) 1004  Fix defect J#1234        1.1 
10)1002  Implement new proper     2.0
         ty formats

Feedback