Skip to content

Commit c6b056d

Browse files
committed
Add short-name and long-name to VTree::Node
1 parent c384d6c commit c6b056d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/Terminal/Widgets/Volatile/DirTree.rakumod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ constant VTree = Terminal::Widgets::Volatile::Tree;
1010
role PathContainer {
1111
has IO::Path:D() $.path is required;
1212

13+
#| Short name: just the basename
14+
method short-name() { $!path.basename }
15+
16+
#| Long name: full resolved path
17+
method long-name() { $!path.resolve }
18+
1319
#| Simplified gist that does not traverse parents, and includes path
1420
method gist(::?CLASS:D:) {
1521
self.gist-name ~ ':' ~ $!path.path

lib/Terminal/Widgets/Volatile/Tree.rakumod

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ unit module Terminal::Widgets::Volatile::Tree;
77
role Node {
88
has Node $.parent;
99

10-
#| Shortened name for gists
10+
#| REQUIRED: Short name for display, usually unique within siblings
11+
method short-name() { ... }
12+
13+
#| REQUIRED: Long name for display, usually unique within entire tree
14+
method long-name() { ... }
15+
16+
#| Shortened class name for gists
1117
method gist-name() {
1218
self.^name.subst('Terminal::Widgets::', '')
1319
}

0 commit comments

Comments
 (0)