easypeasy.format.ps1xml

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
  <ViewDefinitions>
    <View>
      <Name>EnvironmentVariable</Name>
      <ViewSelectedBy>
        <TypeName>EnvironmentVariable</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Label>Scope</Label>
            <Width>10</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Name</Label>
            <Width>30</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Value</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <PropertyName>Scope</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Name</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Value</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
    <View>
      <Name>Shortcut</Name>
      <ViewSelectedBy>
        <TypeName>Shortcut</TypeName>
      </ViewSelectedBy>
      <ListControl>
        <ListEntries>
          <ListEntry>
            <ListItems>
              <ListItem>
                <PropertyName>Location</PropertyName>
              </ListItem>
              <ListItem>
                <PropertyName>Target</PropertyName>
              </ListItem>
              <ListItem>
                <PropertyName>Arguments</PropertyName>
              </ListItem>
              <ListItem>
                <PropertyName>RunLocation</PropertyName>
              </ListItem>
              <ListItem>
                <PropertyName>Description</PropertyName>
              </ListItem>
              <ListItem>
                <Label>Icon</Label>
                <ScriptBlock>$_.Icon?.ToString()</ScriptBlock>
              </ListItem>
              <ListItem>
                <PropertyName>Hotkey</PropertyName>
              </ListItem>
              <ListItem>
                <PropertyName>WindowStyle</PropertyName>
              </ListItem>
              <ListItem>
                <PropertyName>Elevated</PropertyName>
              </ListItem>
            </ListItems>
          </ListEntry>
        </ListEntries>
      </ListControl>
    </View>
    <View>
      <Name>SystemPathLocation</Name>
      <ViewSelectedBy>
        <TypeName>SystemPathLocation</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Label>Scope</Label>
            <Width>10</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Location</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <Wrap/>
            <TableColumnItems>
              <TableColumnItem>
                <PropertyName>Scope</PropertyName>
              </TableColumnItem>
              <!--
                StoredValue is shown as persisted. A %...% reference is the one form that hides which
                folder an entry names, so that entry carries a second line with the resolved Location.
                An entry naming no existing folder is accented.
              -->
              <TableColumnItem>
                <ScriptBlock>
                  $missing = $null -eq $_.Location -or
                      -not (Test-Path -LiteralPath $_.Location -PathType Container -ErrorAction Ignore)
                  $accent = $PSStyle.Foreground.Red
                  $reset = $PSStyle.Reset

                  if ($null -eq $_.Location) {
                      "$accent$($_.StoredValue)$reset"
                  }
                  elseif ($_.StoredValue -match '%[^%]+%' -and $_.Location -cne $_.StoredValue) {
                      $resolved = $missing ? "$accent↳ $($_.Location)$reset" : "↳ $($_.Location)"
                      "$($_.StoredValue)`n$resolved"
                  }
                  else {
                      $missing ? "$accent$($_.StoredValue)$reset" : $_.StoredValue
                  }
                </ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
  </ViewDefinitions>
</Configuration>