xml/Symlink.Format.ps1xml
<?xml version="1.0" encoding="utf-16"?>
<Configuration> <!-- General settings. --> <DefaultSettings> <!-- Shows a '#ERR' string when an error occurs it retrieving data. --> <DisplayError/> </DefaultSettings> <!-- Selection Sets to simplify view declerations. --> <SelectionSets> <!-- Symlink Set --> <SelectionSet> <Name>Set.Symlink</Name> <Types> <TypeName>Symlink</TypeName> <TypeName>Deserialized.Symlink</TypeName> </Types> </SelectionSet> </SelectionSets> <!-- View definitions. --> <ViewDefinitions> <!-- symlink LIST --> <View> <Name>Symlink.List</Name> <ViewSelectedBy> <SelectionSetName>Set.Symlink</SelectionSetName> </ViewSelectedBy> <ListControl> <ListEntries> <!-- BASIC Formatting --> <ListEntry> <ListItems> <!-- The symlink name. --> <ListItem> <Label>Name</Label> <ScriptBlock> "`e[1;4m$($_.Name)`e[0m" </ScriptBlock> </ListItem> <!-- The symlink location. --> <ListItem> <Label>Path</Label> <ScriptBlock> $_.FullPath() </ScriptBlock> </ListItem> <!-- The symlink target. --> <!-- Present the true and expanded path. --> <ListItem> <Label>Target</Label> <ScriptBlock> return $_.FullTarget() </ScriptBlock> </ListItem> <!-- Whether the symlink exists or not. --> <ListItem> <Label>Exists on Filesystem</Label> <ScriptBlock> switch ($_.State()) { True { return "`e[32m$true`e[0m" } False { return "`e[33m$false`e[0m" } NeedsCreation { return "`e[31;4m$false!`e[0m `e[4m(Needs Creation)`e[0m" } NeedsDeletion { return "`e[33m$true!`e[0m `e[4m(Needs Deletion)`e[0m" } Error { return "`e[31mAn error has occured!`e[0m" } } </ScriptBlock> </ListItem> <!-- The creation condition, only if there is one. --> <!-- The default condition should not be shown. --> <ListItem> <Label>Creation Condition</Label> <ItemSelectionCondition> <ScriptBlock> if ($null -ne $_._Condition) { return $true } else { return $false } </ScriptBlock> </ItemSelectionCondition> <ScriptBlock> $var = $_._Condition.ToString().Split("`n") | Foreach-Object { " $_`n" } "{`n" + $var + "}" </ScriptBlock> </ListItem> </ListItems> </ListEntry> <!-- FANCY Formatting --> <ListEntry> <EntrySelectedBy> <SelectionCondition> <SelectionSetName>Set.Symlink</SelectionSetName> <ScriptBlock> if ($null -ne $env:WT_SESSION) { return $true } </ScriptBlock> </SelectionCondition> </EntrySelectedBy> <ListItems> <!-- The symlink name. --> <ListItem> <Label>Name</Label> <ScriptBlock> "`e[97;4m$($_.Name)`e[0m" </ScriptBlock> </ListItem> <!-- The symlink location. --> <ListItem> <Label>Path</Label> <ScriptBlock> $_.FullPath() </ScriptBlock> </ListItem> <!-- The symlink target. --> <!-- Present the true and expanded path. --> <ListItem> <Label>Target</Label> <ScriptBlock> $_.FullTarget() </ScriptBlock> </ListItem> <!-- Whether the symlink exists or not. --> <!-- Also shows if it needs to be created or deleted. --> <ListItem> <Label>Exists on Filesystem</Label> <ScriptBlock> switch ($_.State()) { True { return "`e[32m$true ✅`e[0m" } False { return "`e[33m$false ✅`e[0m" } NeedsCreation { return "`e[31;21m$false`e[0m❗ `e[97m(Needs Creation)`e[0m" } NeedsDeletion { return "`e[33m$true`e[0m❗ `e[97m(Needs Deletion)`e[0m" } Error { return "`e[31;4mAn error has occured`e[0m❗" } } </ScriptBlock> </ListItem> <!-- The creation condition, only if there is one. --> <!-- A non-existent condition should not be shown. --> <ListItem> <Label>Creation Condition</Label> <ItemSelectionCondition> <ScriptBlock> if ($null -ne $_._Condition) { return $true } else { return $false } </ScriptBlock> </ItemSelectionCondition> <ScriptBlock> $var = $_._Condition.ToString().Split("`n") | Foreach-Object { " $_`n" } "{`n" + $var + "}" </ScriptBlock> </ListItem> </ListItems> </ListEntry> </ListEntries> </ListControl> </View> <!-- symlink CUSTOM --> <View> <Name>Symlink.Custom</Name> <ViewSelectedBy> <SelectionSetName>Set.Symlink</SelectionSetName> </ViewSelectedBy> <CustomControl> <CustomEntries> <!-- BASIC Formatting --> <CustomEntry> <CustomItem> <Frame> <CustomItem> <NewLine /> <ExpressionBinding> <ScriptBlock> "class Symlink" </ScriptBlock> </ExpressionBinding> <NewLine /> <Text>{</Text> <NewLine /> <Frame> <LeftIndent>4</LeftIndent> <CustomItem> <!-- The name of the symlink. --> <ExpressionBinding> <ScriptBlock> "Name = $($_.Name)" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The path of the symlink. --> <ExpressionBinding> <ScriptBlock> "Path = $($_._Path)" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The target of the symlink. --> <ExpressionBinding> <ScriptBlock> "Target = $($_._Target)" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The condition of the symlink. --> <ExpressionBinding> <ScriptBlock> if ($null -eq $_._Condition) { "Condition = NULL" } else { "Condition = $($_._Condition)" } </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The ShortPath() of the symlink. --> <ExpressionBinding> <ScriptBlock> "ShortPath() = $($_.ShortPath())" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The FullPath() of the symlink. --> <ExpressionBinding> <ScriptBlock> "FullPath() = $($_.FullPath())" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The ShortTarget() of the symlink. --> <ExpressionBinding> <ScriptBlock> "ShortTarget() = $($_.ShortTarget())" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The FullTarget() of the symlink. --> <ExpressionBinding> <ScriptBlock> "FullTarget() = $($_.FullTarget())" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The Exists() of the symlink. --> <ExpressionBinding> <ScriptBlock> "Exists() = $($_.Exists())" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The ShouldExist() of the symlink. --> <ExpressionBinding> <ScriptBlock> "ShouldExist() = $($_.ShouldExist())" </ScriptBlock> </ExpressionBinding> <NewLine /> <!-- The State() of the symlink. --> <ExpressionBinding> <ScriptBlock> "State() = $($_.State())" </ScriptBlock> </ExpressionBinding> <NewLine /> </CustomItem> </Frame> <Text>}</Text> </CustomItem> </Frame> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </View> <!-- symlink TABLE --> <View> <Name>Symlink.Table</Name> <ViewSelectedBy> <SelectionSetName>Set.Symlink</SelectionSetName> </ViewSelectedBy> <TableControl> <!-- The table headers. --> <TableHeaders> <TableColumnHeader> <Label>Name</Label> <Width>25</Width> <Alignment>Left</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Path</Label> <Width>35</Width> <Alignment>Left</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Target</Label> <Width>35</Width> <Alignment>Left</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Condition</Label> <Width>10</Width> <Alignment>Left</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Exists</Label> <Width>7</Width> <Alignment>Right</Alignment> </TableColumnHeader> </TableHeaders> <!-- The table rows. --> <TableRowEntries> <!-- BASIC Formatting --> <TableRowEntry> <TableColumnItems> <!-- The symlink name. --> <TableColumnItem> <PropertyName>Name</PropertyName> </TableColumnItem> <!-- The symlink location. --> <TableColumnItem> <ScriptBlock> $_.ShortPath() </ScriptBlock> </TableColumnItem> <!-- The symlink target. --> <TableColumnItem> <ScriptBlock> $_.ShortTarget() </ScriptBlock> </TableColumnItem> <!-- Whether the symlink has a condition. --> <TableColumnItem> <ScriptBlock> if ($_._Condition) { return "`e[32mYes`e[0m" }else { return "`e[33mNo`e[0m" } </ScriptBlock> </TableColumnItem> <!-- Whether the symlink exists or not. --> <TableColumnItem> <ScriptBlock> switch ($_.State()) { True { return "`e[32m$true`e[0m" } False { return "`e[33m$false`e[0m" } NeedsCreation { return "`e[31;4m$false!`e[0m" } NeedsDeletion { return "`e[33m$true!`e[0m" } Error { return "`e[31mERROR!`e[0m" } } </ScriptBlock> </TableColumnItem> </TableColumnItems> </TableRowEntry> <!-- FANCY Formatting --> <TableRowEntry> <EntrySelectedBy> <SelectionCondition> <SelectionSetName>Set.Symlink</SelectionSetName> <ScriptBlock> if ($env:WT_SESSION) { return $true } </ScriptBlock> </SelectionCondition> </EntrySelectedBy> <TableColumnItems> <!-- The symlink name. --> <TableColumnItem> <PropertyName>Name</PropertyName> <Alignment>Left</Alignment> </TableColumnItem> <!-- The symlink location. --> <TableColumnItem> <ScriptBlock> $_.ShortPath() </ScriptBlock> <Alignment>Left</Alignment> </TableColumnItem> <!-- The symlink target. --> <TableColumnItem> <ScriptBlock> $_.ShortTarget() </ScriptBlock> <Alignment>Left</Alignment> </TableColumnItem> <!-- Whether the symlink has a condition. --> <TableColumnItem> <ScriptBlock> if ($_._Condition) { return "✅" }else { return "❌" } </ScriptBlock> </TableColumnItem> <!-- Whether the symlink exists or not. --> <TableColumnItem> <ScriptBlock> switch ($_.State()) { True { return "`e[32m$true`e[0m" } False { return "`e[33m$false`e[0m" } NeedsCreation { return "`e[31;21m$false`e[0m❗" } NeedsDeletion { return "`e[33m$true`e[0m❗" } Error { return "`e[31mERROR`e[0m❗" } } </ScriptBlock> </TableColumnItem> </TableColumnItems> </TableRowEntry> </TableRowEntries> </TableControl> </View> <!-- symlink WIDE --> <View> <Name>Symlink.Wide</Name> <ViewSelectedBy> <SelectionSetName>Set.Symlink</SelectionSetName> </ViewSelectedBy> <WideControl> <WideEntries> <!-- BASIC Formatting --> <WideEntry> <!-- The symlink name. --> <WideItem> <ScriptBlock> $name = $_.Name switch ($_.State()) { True { return "`e[32m$name`e[0m" } False { return "`e[33m$name`e[0m" } NeedsCreation { return "`e[31;4m$name!`e[0m" } NeedsDeletion { return "`e[33m$name!`e[0m" } Error { return "`e[31mError!`e[0m" } } </ScriptBlock> </WideItem> </WideEntry> <!-- FANCY Formatting --> <WideEntry> <EntrySelectedBy> <SelectionCondition> <SelectionSetName>Set.Symlink</SelectionSetName> <ScriptBlock> if ($env:WT_SESSION) { return $true } </ScriptBlock> </SelectionCondition> </EntrySelectedBy> <!-- The symlink name. --> <WideItem> <ScriptBlock> $name = $_.Name switch ($_.State()) { True { return "`e[32m$name✅`e[0m" } False { return "`e[33m$name✅`e[0m" } NeedsCreation { return "`e[31;21m$name`e[0m❗" } NeedsDeletion { return "`e[33m$name`e[0m❗" } Error { return "`e[31;4mERROR`e[0m❗" } } </ScriptBlock> </WideItem> </WideEntry> </WideEntries> </WideControl> </View> </ViewDefinitions> </Configuration> |