feat: add -with-displayname flag to lists
This commit is contained in:
parent
2e17522de6
commit
c62b9c2d40
@ -75,6 +75,8 @@ public static class ContextListExt
|
|||||||
p.IncludeAvatar = true;
|
p.IncludeAvatar = true;
|
||||||
if (ctx.MatchFlag("with-pronouns", "wp"))
|
if (ctx.MatchFlag("with-pronouns", "wp"))
|
||||||
p.IncludePronouns = true;
|
p.IncludePronouns = true;
|
||||||
|
if (ctx.MatchFlag("with-displayname", "wdn"))
|
||||||
|
p.IncludeDisplayName = true;
|
||||||
|
|
||||||
// Always show the sort property, too
|
// Always show the sort property, too
|
||||||
if (p.SortProperty == SortProperty.LastSwitch) p.IncludeLastSwitch = true;
|
if (p.SortProperty == SortProperty.LastSwitch) p.IncludeLastSwitch = true;
|
||||||
@ -166,6 +168,10 @@ public static class ContextListExt
|
|||||||
{
|
{
|
||||||
ret += $"({count} messages)";
|
ret += $"({count} messages)";
|
||||||
}
|
}
|
||||||
|
else if (opts.IncludeDisplayName && m.DisplayName != null && m.NamePrivacy.CanAccess(lookupCtx))
|
||||||
|
{
|
||||||
|
ret += $"({m.DisplayName})";
|
||||||
|
}
|
||||||
else if (opts.IncludeLastSwitch &&
|
else if (opts.IncludeLastSwitch &&
|
||||||
m.MetadataPrivacy.TryGet(lookupCtx, m.LastSwitchTime, out var lastSw))
|
m.MetadataPrivacy.TryGet(lookupCtx, m.LastSwitchTime, out var lastSw))
|
||||||
{
|
{
|
||||||
@ -305,6 +311,10 @@ public static class ContextListExt
|
|||||||
{
|
{
|
||||||
ret += $"(created at <t:{created.ToUnixTimeSeconds()}>)";
|
ret += $"(created at <t:{created.ToUnixTimeSeconds()}>)";
|
||||||
}
|
}
|
||||||
|
else if (opts.IncludeDisplayName && g.DisplayName != null && g.NamePrivacy.CanAccess(lookupCtx))
|
||||||
|
{
|
||||||
|
ret += $"({g.DisplayName})";
|
||||||
|
}
|
||||||
else if (opts.IncludeAvatar && g.IconFor(lookupCtx) is { } avatarUrl)
|
else if (opts.IncludeAvatar && g.IconFor(lookupCtx) is { } avatarUrl)
|
||||||
{
|
{
|
||||||
ret += $"([avatar URL]({avatarUrl}))";
|
ret += $"([avatar URL]({avatarUrl}))";
|
||||||
|
@ -24,6 +24,7 @@ public class ListOptions
|
|||||||
public bool IncludeCreated { get; set; }
|
public bool IncludeCreated { get; set; }
|
||||||
public bool IncludeAvatar { get; set; }
|
public bool IncludeAvatar { get; set; }
|
||||||
public bool IncludePronouns { get; set; }
|
public bool IncludePronouns { get; set; }
|
||||||
|
public bool IncludeDisplayName { get; set; }
|
||||||
|
|
||||||
public string CreateFilterString()
|
public string CreateFilterString()
|
||||||
{
|
{
|
||||||
|
@ -64,6 +64,7 @@ You cannot look up private members or groups of another system.
|
|||||||
|-with-created|-wc|Member, Group|Show each item's creation date|
|
|-with-created|-wc|Member, Group|Show each item's creation date|
|
||||||
|-with-avatar|-wa, -wi, -ia, -ii, -img|Member, Group|Show each item's avatar URL|
|
|-with-avatar|-wa, -wi, -ia, -ii, -img|Member, Group|Show each item's avatar URL|
|
||||||
|-with-pronouns|-wp|Member|Show each member's pronouns in the short list (shown by default in full list)|
|
|-with-pronouns|-wp|Member|Show each member's pronouns in the short list (shown by default in full list)|
|
||||||
|
|-with-displayname|-wdn|Member, Group|Show each item's displayname|
|
||||||
|
|
||||||
## Miscellaneous flags
|
## Miscellaneous flags
|
||||||
|Command|Flag|Aliases|Description|
|
|Command|Flag|Aliases|Description|
|
||||||
|
Loading…
Reference in New Issue
Block a user