Nuke.Cola
Loading...
Searching...
No Matches
Nuke.Cola.Tooling.XRepoItem Class Reference

A structured representation of the data xrepo info prints out about a package. xrepo info uses a bespoke format which expresses data relationship with indentation. One item can have multiple items associated with it if they're indented further inside. It's almost like YAML but it differs ever so slightly. Items can have a key optionally if they have : after a single first word these are named items and accessible with a string indexer. Value only items are accessible only through an integer indexer. All items are iterated upon via the IEnumerable interface. More...

Inheritance diagram for Nuke.Cola.Tooling.XRepoItem:

Public Types

enum  Kind {
  Root , Package , Key , Property ,
  Value , Invalid
}
 Kind of the info item represented. More...
 

Public Member Functions

IEnumerator< XRepoItemGetEnumerator ()
 

Static Package Functions

static XRepoItem Parse (IEnumerable< Output > toolOutput)
 Parse the xrepo info structure from a Tool output.
 

Properties

required Kind ItemKind [get]
 To help distinguish items from each other.
 
string? Value [get]
 This item specifies a value which is arbitrary text either after key: or the entire line if key was not present.
 
string? Key [get]
 This item specifies a key which is a short identifier at the beginning of the line like mykey:
 
XRepoItemthis[int i] [get]
 Get one unnamed sub-item, return null if out-of-bounds.
 
XRepoItemthis[string i] [get]
 Get one named sub-item, return null if doesn't exist.
 

Private Member Functions

IEnumerator IEnumerable. GetEnumerator ()
 

Static Private Member Functions

static bool IsItemLine (string line)
 
static bool IsWithinCurrentItem (string line, int indent)
 
static int GetIndent (string line)
 
static XRepoItem Parse (ref List< string > infoOutput, ref int i)
 

Private Attributes

List< XRepoItem_unnamedItems = []
 
Dictionary< string, XRepoItem_namedItems = []
 

Static Private Attributes

const int MinimumIndent = 4
 

Detailed Description

A structured representation of the data xrepo info prints out about a package. xrepo info uses a bespoke format which expresses data relationship with indentation. One item can have multiple items associated with it if they're indented further inside. It's almost like YAML but it differs ever so slightly. Items can have a key optionally if they have : after a single first word these are named items and accessible with a string indexer. Value only items are accessible only through an integer indexer. All items are iterated upon via the IEnumerable interface.

Definition at line 22 of file XRepoItem.cs.

Member Enumeration Documentation

◆ Kind

Kind of the info item represented.

Enumerator
Root 

The main item containing all other items output by xrepo info. It has no key and no value.

Package 

Represents data abpuut a package (require(myPackage)). It has Key only.

Key 

An item which has only a key and no value ( -> mykey:)

Property 

An item which has both a key and a value ( -> mykey: foobar)

Value 

An item which doesn't have a key associated usually a list of stuff ( -> foobar)

Invalid 

If for any cursed reason an item couldn't be parsed while it was passing the IsItemLine check. This indicates a bug in the code.

Definition at line 27 of file XRepoItem.cs.

Member Function Documentation

◆ GetEnumerator() [1/2]

IEnumerator< XRepoItem > Nuke.Cola.Tooling.XRepoItem.GetEnumerator ( )

Definition at line 82 of file XRepoItem.cs.

◆ GetEnumerator() [2/2]

IEnumerator IEnumerable. Nuke.Cola.Tooling.XRepoItem.GetEnumerator ( )
private

Definition at line 88 of file XRepoItem.cs.

◆ Parse() [1/2]

static XRepoItem Nuke.Cola.Tooling.XRepoItem.Parse ( IEnumerable< Output > toolOutput)
staticpackage

Parse the xrepo info structure from a Tool output.

Definition at line 169 of file XRepoItem.cs.

◆ Parse() [2/2]

static XRepoItem Nuke.Cola.Tooling.XRepoItem.Parse ( ref List< string > infoOutput,
ref int i )
staticprivate

Definition at line 116 of file XRepoItem.cs.

Member Data Documentation

◆ _namedItems

Dictionary<string, XRepoItem> Nuke.Cola.Tooling.XRepoItem._namedItems = []
private

Definition at line 80 of file XRepoItem.cs.

◆ _unnamedItems

List<XRepoItem> Nuke.Cola.Tooling.XRepoItem._unnamedItems = []
private

Definition at line 79 of file XRepoItem.cs.

◆ MinimumIndent

const int Nuke.Cola.Tooling.XRepoItem.MinimumIndent = 4
staticprivate

Definition at line 104 of file XRepoItem.cs.

Property Documentation

◆ ItemKind

required Kind Nuke.Cola.Tooling.XRepoItem.ItemKind
get

To help distinguish items from each other.

Definition at line 65 of file XRepoItem.cs.

◆ Key

string? Nuke.Cola.Tooling.XRepoItem.Key
get

This item specifies a key which is a short identifier at the beginning of the line like mykey:

Definition at line 77 of file XRepoItem.cs.

◆ this[int i]

XRepoItem? Nuke.Cola.Tooling.XRepoItem.this[int i]
get

Get one unnamed sub-item, return null if out-of-bounds.

Definition at line 97 of file XRepoItem.cs.

◆ this[string i]

XRepoItem? Nuke.Cola.Tooling.XRepoItem.this[string i]
get

Get one named sub-item, return null if doesn't exist.

Definition at line 102 of file XRepoItem.cs.

◆ Value

string? Nuke.Cola.Tooling.XRepoItem.Value
get

This item specifies a value which is arbitrary text either after key: or the entire line if key was not present.

Definition at line 71 of file XRepoItem.cs.


The documentation for this class was generated from the following file: