Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
App::Sqitch::ItemFormaUser(Contributed Perl DocumApp::Sqitch::ItemFormatter(3)

Name
       App::Sqitch::ItemFormatter - Format events and changes for command
       output

Synopsis
	 my $formatter = App::Sqitch::ItemFormatter->new(%params);
	 say $formatter->format($format, $item);

Description
       This class is used by commands to format	items for output. For example,
       "log" uses it to	format the events it finds. It uses String::Formatter
       to do the actual	formatting, but	configures it for all the various
       times of	things typically displayed, such as change names, IDs, event
       types, etc. This	keeps things relatively	simple,	as all one needs to
       pass to "format()" is a format and then a hash reference	of values to
       be used in the format.

Interface
   Constructor
       "new"

	 my $formatter = App::Sqitch::ItemFormatter->new(%params);

       Constructs and returns a	formatter object. The supported	parameters
       are:

       "abbrev"
	   Instead of showing the full 40-byte hexadecimal change ID, format
	   as a	partial	prefix the specified number of characters long.

       "date_format"
	   Format to use for timestamps. Defaults to "iso". Allowed values:

	   "iso"
	   "iso8601"
	       ISO-8601	format.

	   "rfc"
	   "rfc2822"
	       RFC-2822	format.

	   "full"
	   "long"
	   "medium"
	   "short"
	       A format	length to pass to the system locale's "LC_TIME"
	       category.

	   "raw"
	       Raw format, which is strict ISO-8601 in the UTC time zone.

	   "strftime:$string"
	       An arbitrary "strftime" pattern.	See "strftime Paterns" in
	       DateTime	for comprehensive documentation	of supported patterns.

	   "cldr:$pattern"
	       An arbitrary "cldr" pattern. See	"CLDR Paterns" in DateTime for
	       comprehensive documentation of supported	patterns.

       "color"
	   Controls the	use of ANSI color formatting. The value	may be one of:

	   "auto" (the default)
	   "always"
	   "never"
       "formatter"
	   A String::Formatter object. You probably don't want to pass one of
	   these, as the default one understands all the values	to that	Sqitch
	   is likely to	want to	format.

   Instance Methods
       "format"

	 $formatter->format( $format, $item );

       Formats an item as a string and returns it. The item will be formatted
       using the first argument. See "Formats" for the gory details.

       The second argument is a	hash reference defining	the item to be
       formatted.  These are simple key/value pairs, generally identifying
       attribute names and values. The supported keys are:

       "event"
	   The type of event, which is one of:

	   "deploy"
	   "revert"
	   "fail"
       "project"
	   The name of the project with	which the change is associated.

       "change_id"
	   The change ID.

       "change"
	   The name of the change.

       "note"
	   A brief description of the change.

       "tags"
	   An array reference of the names of associated tags.

       "requires"
	   An array reference of the names of any changes required by the
	   change.

       "conflicts"
	   An array reference of the names of any changes that conflict	with
	   the change.

       "committed_at"
	   An App::Sqitch::DateTime object representing	the date and time at
	   which the event was logged.

       "committer_name"
	   Name	of the user who	deployed the change.

       "committer_email"
	   Email address of the	user who deployed the change.

       "planned_at"
	   An App::Sqitch::DateTime object representing	the date and time at
	   which the change was	added to the plan.

       "planner_name"
	   Name	of the user who	added the change to the	plan.

       "planner_email"
	   Email address of the	user who added the change to the plan.

Formats
       The format argument to "format()" specifies the item information	to be
       included	in the resulting string. It works a little bit like "printf"
       format and a little like	Git log	format.	For example, this format:

	 format:The committer of %h was	%{name}c%vThe title was	>>%s<<%v

       Would show something like this:

	 The committer of f26a3s was Tom Lane
	 The title was >>We really need	to get this right.<<

       The placeholders	are:

       o   %H: Event change ID

       o   %h: Event change ID (respects "--abbrev")

       o   %n: Event change name

       o   %o: Event change project name

       o   "%($len)h": abbreviated change of length $len

       o   %e: Event type (deploy, revert, fail)

       o   %l: Localized lowercase event type label

       o   %L: Localized title case event type label

       o   %c: Event committer name and	email address

       o   "%{name}c": Event committer name

       o   "%{email}c":	Event committer	email address

       o   "%{date}c": commit date (respects "--date-format")

       o   "%{date:rfc}c": commit date,	RFC2822	format

       o   "%{date:iso}c": commit date,	ISO-8601 format

       o   "%{date:full}c": commit date, full format

       o   "%{date:long}c": commit date, long format

       o   "%{date:medium}c": commit date, medium format

       o   "%{date:short}c": commit date, short	format

       o   "%{date:cldr:$pattern}c": commit date, formatted with custom	CLDR
	   pattern

       o   "%{date:strftime:$pattern}c": commit	date, formatted	with custom
	   strftime pattern

       o   %c: Change planner name and email address

       o   "%{name}p": Change planner name

       o   "%{email}p":	Change planner email address

       o   "%{date}p": plan date (respects "--date-format")

       o   "%{date:rfc}p": plan	date, RFC2822 format

       o   "%{date:iso}p": plan	date, ISO-8601 format

       o   "%{date:full}p": plan date, full format

       o   "%{date:long}p": plan date, long format

       o   "%{date:medium}p": plan date, medium	format

       o   "%{date:short}p": plan date,	short format

       o   "%{date:cldr:$pattern}p": plan date,	formatted with custom CLDR
	   pattern

       o   "%{date:strftime:$pattern}p": plan date, formatted with custom
	   strftime pattern

       o   %t: Comma-delimited list of tags

       o   "%{$sep}t": list of tags delimited by $sep

       o   %T: Parenthesized list of comma-delimited tags

       o   "%{$sep}T": Parenthesized list of tags delimited by $sep

       o   %s: Subject (a.k.a. title line)

       o   %r: Comma-delimited list of required	changes

       o   "%{$sep}r": list of required	changes	delimited by $sep

       o   %R: Localized label and list	of comma-delimited required changes

       o   "%{$sep}R": Localized label and list	of required changes delimited
	   by $sep

       o   %x: Comma-delimited list of conflicting changes

       o   "%{$sep}x": list of conflicting changes delimited by	$sep

       o   %X: Localized label and list	of comma-delimited conflicting changes

       o   "%{$sep}X": Localized label and list	of conflicting changes
	   delimited by	$sep

       o   %b: Body

       o   %B: Raw body	(unwrapped subject and body)

       o   "%{$prefix}"B: Raw body with	$prefix	prefixed to every line

       o   "%{event}_" Localized label for "event"

       o   "%{change}_"	Localized label	for "change"

       o   "%{committer}_" Localized label for "committer"

       o   "%{planner}_" Localized label for "planner"

       o   "%{by}_" Localized label for	"by"

       o   "%{date}_" Localized	label for "date"

       o   "%{committed}_" Localized label for "committed"

       o   "%{planned}_" Localized label for "planned"

       o   "%{name}_" Localized	label for "name"

       o   "%{project}_" Localized label for "project"

       o   "%{email}_" Localized label for "email"

       o   "%{requires}_" Localized label for "requires"

       o   "%{conflicts}_" Localized label for "conflicts"

       o   %v vertical space (newline)

       o   "%{$color}C": An ANSI color:	black, red, green, yellow, reset, etc.

       o   "%{:event}C": An ANSI color based on	event type (green deploy, blue
	   revert, red fail)

       o   "%{$attribute}a": The raw attribute name and	value, if it exists
	   and has a value

See Also
       sqitch-log
	   Documentation for the "log" command to the Sqitch command-line
	   client.

       sqitch
	   The Sqitch command-line client.

Author
       David E.	Wheeler	<david@justatheory.com>

License
       Copyright (c) 2012-2015 iovation	Inc.

       Permission is hereby granted, free of charge, to	any person obtaining a
       copy of this software and associated documentation files	(the
       "Software"), to deal in the Software without restriction, including
       without limitation the rights to	use, copy, modify, merge, publish,
       distribute, sublicense, and/or sell copies of the Software, and to
       permit persons to whom the Software is furnished	to do so, subject to
       the following conditions:

       The above copyright notice and this permission notice shall be included
       in all copies or	substantial portions of	the Software.

       THE SOFTWARE IS PROVIDED	"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
       OR IMPLIED, INCLUDING BUT NOT LIMITED TO	THE WARRANTIES OF
       MERCHANTABILITY,	FITNESS	FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
       IN NO EVENT SHALL THE AUTHORS OR	COPYRIGHT HOLDERS BE LIABLE FOR	ANY
       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN	ACTION OF CONTRACT,
       TORT OR OTHERWISE, ARISING FROM,	OUT OF OR IN CONNECTION	WITH THE
       SOFTWARE	OR THE USE OR OTHER DEALINGS IN	THE SOFTWARE.

perl v5.24.1			  2017-07-03	 App::Sqitch::ItemFormatter(3)

Name | Synopsis | Description | Interface | Formats | See Also | Author | License

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=App::Sqitch::ItemFormatter&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help