fork/gdu

git clone https://git.julia.blue/fork/gdu

yurenchen000Feat: Show symlink target #260 (#612)1eaa266

subvolume
19.7 KiB734 linesraw
1package tui
2
3import (
4	"fmt"
5	"io"
6	"os"
7	"os/signal"
8	"runtime"
9	"strings"
10	"sync"
11	"syscall"
12	"time"
13	"unicode"
14
15	log "github.com/sirupsen/logrus"
16
17	"github.com/dundee/gdu/v5/internal/common"
18	"github.com/dundee/gdu/v5/pkg/analyze"
19	"github.com/dundee/gdu/v5/pkg/device"
20	"github.com/dundee/gdu/v5/pkg/fs"
21	"github.com/dundee/gdu/v5/pkg/remove"
22	"github.com/dundee/gdu/v5/pkg/timefilter"
23	"github.com/gdamore/tcell/v2"
24	"github.com/rivo/tview"
25)
26
27// UI struct
28type UI struct {
29	app        common.TermApplication
30	screen     tcell.Screen
31	output     io.Writer
32	currentDir fs.Item
33	topDir     fs.Item
34	getter     device.DevicesInfoGetter
35	*common.UI
36	grid                    *tview.Grid
37	header                  *tview.TextView
38	footer                  *tview.Flex
39	footerLabel             *tview.TextView
40	currentDirLabel         *tview.TextView
41	pages                   *tview.Pages
42	progress                *tview.TextView
43	progressBar             *ProgressBar
44	status                  *tview.TextView
45	help                    *tview.Flex
46	table                   *tview.Table
47	filteringInput          *tview.InputField
48	typeFilteringInput      *tview.InputField
49	done                    chan struct{}
50	remover                 func(fs.Item, fs.Item) error
51	emptier                 func(fs.Item, fs.Item) error
52	trasher                 func(fs.Item, fs.Item) error
53	exec                    func(argv0 string, argv []string, envv []string) error
54	changeCwdFn             func(string) error
55	linkedItems             fs.HardLinkedItems
56	ignoredRows             map[int]struct{}
57	markedRows              map[int]struct{}
58	markedPaths             []string
59	deleteQueue             chan deleteQueueItem
60	resultRow               ResultRow
61	topDirPath              string
62	currentDirPath          string
63	filterValue             string
64	typeFilterValue         string
65	sortBy                  string
66	sortOrder               string
67	footerTextColor         string
68	footerBackgroundColor   string
69	footerNumberColor       string
70	headerTextColor         string
71	headerBackgroundColor   string
72	defaultSortBy           string
73	defaultSortOrder        string
74	exportName              string
75	devices                 []*device.Device
76	selectedTextColor       tcell.Color
77	selectedBackgroundColor tcell.Color
78	markedTextColor         tcell.Color
79	markedBackgroundColor   tcell.Color
80	currentItemNameMaxLen   int
81	activeWorkers           int
82	deleteWorkersCount      int
83	statusMut               sync.RWMutex
84	workersMut              sync.Mutex
85	askBeforeDelete         bool
86	showItemCount           bool
87	showSymlinkTarget       bool
88	showMtime               bool
89	filtering               bool
90	typeFiltering           bool
91	headerHidden            bool
92	useOldSizeBar           bool
93	showBarPercentage       bool
94	noDelete                bool
95	noViewFile              bool
96	noSpawnShell            bool
97	deleteInBackground      bool
98	timeFilter              *timefilter.TimeFilter
99	timeFilterLoc           *time.Location
100	noDeleteWithFilter      bool
101	collapsePath            bool
102	browseParentDirs        bool
103	showDiskProgressBar     bool
104	currentDeviceSize       int64
105	confirmQuit             bool
106	scanning                bool
107	scanCancelled           bool
108	scanStart               time.Time
109	scanDuration            time.Duration
110	previewing              bool
111	previewSavedDir         fs.Item
112	progressFlex            *tview.Flex
113}
114
115type deleteQueueItem struct {
116	item   fs.Item
117	action DeleteAction
118}
119
120// ResultRow is a struct for a row in the result table
121type ResultRow struct {
122	NumberColor    string
123	DirectoryColor string
124}
125
126// Option is optional function customizing the behaviour of UI
127type Option func(ui *UI)
128
129// CreateUI creates the whole UI app
130func CreateUI(
131	app common.TermApplication,
132	screen tcell.Screen,
133	output io.Writer,
134	useColors bool,
135	showApparentSize bool,
136	showRelativeSize bool,
137	useSIPrefix bool,
138	opts ...Option,
139) *UI {
140	ui := &UI{
141		UI: &common.UI{
142			UseColors:        useColors,
143			ShowApparentSize: showApparentSize,
144			ShowRelativeSize: showRelativeSize,
145			Analyzer:         analyze.CreateAnalyzer(),
146			UseSIPrefix:      useSIPrefix,
147		},
148		app:                     app,
149		screen:                  screen,
150		output:                  output,
151		askBeforeDelete:         true,
152		confirmQuit:             true,
153		showItemCount:           false,
154		remover:                 remove.ItemFromDir,
155		emptier:                 remove.EmptyFileFromDir,
156		trasher:                 remove.MoveItemToTrash,
157		exec:                    Execute,
158		linkedItems:             make(fs.HardLinkedItems, 10),
159		selectedTextColor:       tview.Styles.TitleColor,
160		selectedBackgroundColor: tview.Styles.MoreContrastBackgroundColor,
161		markedTextColor:         tview.Styles.PrimaryTextColor,
162		markedBackgroundColor:   tview.Styles.ContrastBackgroundColor,
163		currentItemNameMaxLen:   70,
164		defaultSortBy:           "size",
165		defaultSortOrder:        "desc",
166		ignoredRows:             make(map[int]struct{}),
167		markedRows:              make(map[int]struct{}),
168		exportName:              "export.json",
169		noDelete:                false,
170		noViewFile:              false,
171		noSpawnShell:            false,
172		deleteQueue:             make(chan deleteQueueItem, 1000),
173		deleteWorkersCount:      3 * runtime.GOMAXPROCS(0),
174	}
175	if !useSIPrefix {
176		ui.SetBlockSizeFromEnvironment()
177	}
178	for _, o := range opts {
179		o(ui)
180	}
181
182	ui.resetSorting()
183
184	app.SetBeforeDrawFunc(func(screen tcell.Screen) bool {
185		screen.Clear()
186		return false
187	})
188
189	ui.app.SetInputCapture(ui.keyPressed)
190	ui.app.SetMouseCapture(ui.onMouse)
191
192	ui.header = tview.NewTextView()
193	ui.header.SetText(" gdu ~ Use arrow keys to navigate, press ? for help ")
194	ui.header.SetTextColor(tcell.GetColor(ui.headerTextColor))
195	ui.header.SetBackgroundColor(tcell.GetColor(ui.headerBackgroundColor))
196
197	ui.currentDirLabel = tview.NewTextView()
198	ui.currentDirLabel.SetTextColor(tcell.ColorDefault)
199	ui.currentDirLabel.SetBackgroundColor(tcell.ColorDefault)
200
201	ui.table = tview.NewTable().SetSelectable(true, false)
202	ui.table.SetBackgroundColor(tcell.ColorDefault)
203	ui.table.SetSelectedFunc(ui.fileItemSelected)
204
205	if ui.UseColors {
206		ui.table.SetSelectedStyle(tcell.Style{}.
207			Foreground(ui.selectedTextColor).
208			Background(ui.selectedBackgroundColor).Bold(true))
209	} else {
210		ui.table.SetSelectedStyle(tcell.Style{}.
211			Foreground(tcell.ColorWhite).
212			Background(tcell.ColorGray).Bold(true))
213	}
214
215	ui.footerLabel = tview.NewTextView().SetDynamicColors(true)
216	ui.footerLabel.SetTextColor(tcell.GetColor(ui.footerTextColor))
217	ui.footerLabel.SetBackgroundColor(tcell.GetColor(ui.footerBackgroundColor))
218	ui.footerLabel.SetText(" No items to display. ")
219
220	ui.footer = tview.NewFlex()
221	ui.footer.AddItem(ui.footerLabel, 0, 1, false)
222
223	ui.createGrid()
224
225	ui.pages = tview.NewPages().
226		AddPage("background", ui.grid, true, true)
227	ui.pages.SetBackgroundColor(tcell.ColorDefault)
228
229	ui.app.SetRoot(ui.pages, true)
230
231	return ui
232}
233
234// createGrid creates the main grid layout
235func (ui *UI) createGrid() {
236	if ui.headerHidden {
237		ui.grid = tview.NewGrid().SetRows(1, 0, 1).SetColumns(0)
238		ui.grid.AddItem(ui.currentDirLabel, 0, 0, 1, 1, 0, 0, false).
239			AddItem(ui.table, 1, 0, 1, 1, 0, 0, true).
240			AddItem(ui.footer, 2, 0, 1, 1, 0, 0, false)
241	} else {
242		ui.grid = tview.NewGrid().SetRows(1, 1, 0, 1).SetColumns(0)
243		ui.grid.AddItem(ui.header, 0, 0, 1, 1, 0, 0, false).
244			AddItem(ui.currentDirLabel, 1, 0, 1, 1, 0, 0, false).
245			AddItem(ui.table, 2, 0, 1, 1, 0, 0, true).
246			AddItem(ui.footer, 3, 0, 1, 1, 0, 0, false)
247	}
248}
249
250// SetSelectedTextColor sets the color for the highlighted selected text
251func (ui *UI) SetSelectedTextColor(color tcell.Color) {
252	ui.selectedTextColor = color
253}
254
255// SetSelectedBackgroundColor sets the color for the highlighted selected text
256func (ui *UI) SetSelectedBackgroundColor(color tcell.Color) {
257	ui.selectedBackgroundColor = color
258}
259
260// SetMarkedTextColor sets the text color for marked items
261func (ui *UI) SetMarkedTextColor(color tcell.Color) {
262	ui.markedTextColor = color
263}
264
265// SetMarkedBackgroundColor sets the background color for marked items
266func (ui *UI) SetMarkedBackgroundColor(color tcell.Color) {
267	ui.markedBackgroundColor = color
268}
269
270// SetFooterTextColor sets the color for the footer text
271func (ui *UI) SetFooterTextColor(color string) {
272	ui.footerTextColor = color
273}
274
275// SetFooterBackgroundColor sets the color for the footer background
276func (ui *UI) SetFooterBackgroundColor(color string) {
277	ui.footerBackgroundColor = color
278}
279
280// SetFooterNumberColor sets the color for the footer number
281func (ui *UI) SetFooterNumberColor(color string) {
282	ui.footerNumberColor = color
283}
284
285// SetHeaderTextColor sets the color for the header text
286func (ui *UI) SetHeaderTextColor(color string) {
287	ui.headerTextColor = color
288}
289
290// SetHeaderBackgroundColor sets the color for the header background
291func (ui *UI) SetHeaderBackgroundColor(color string) {
292	ui.headerBackgroundColor = color
293}
294
295// SetHeaderHidden sets the flag to hide the header
296func (ui *UI) SetHeaderHidden() {
297	ui.headerHidden = true
298}
299
300// SetResultRowDirectoryColor sets the color for the result row directory
301func (ui *UI) SetResultRowDirectoryColor(color string) {
302	ui.resultRow.DirectoryColor = color
303}
304
305// SetResultRowNumberColor sets the color for the result row number
306func (ui *UI) SetResultRowNumberColor(color string) {
307	ui.resultRow.NumberColor = color
308}
309
310// SetCurrentItemNameMaxLen sets the maximum length of the path of the currently processed item
311// to be shown in the progress modal
312func (ui *UI) SetCurrentItemNameMaxLen(maxLen int) {
313	ui.currentItemNameMaxLen = maxLen
314}
315
316// UseOldSizeBar uses the old size bar (# chars) instead of the new one (unicode block elements)
317func (ui *UI) UseOldSizeBar() {
318	ui.useOldSizeBar = true
319}
320
321// SetShowBarPercentage shows the numeric usage percentage next to the size bar
322func (ui *UI) SetShowBarPercentage() {
323	ui.showBarPercentage = true
324}
325
326// SetChangeCwdFn sets function that can be used to change current working dir
327// during dir browsing
328func (ui *UI) SetChangeCwdFn(fn func(string) error) {
329	ui.changeCwdFn = fn
330}
331
332// SetDeleteInParallel sets the flag to delete files in parallel
333func (ui *UI) SetDeleteInParallel() {
334	ui.remover = remove.ItemFromDirParallel
335}
336
337// StartUILoop starts tview application
338func (ui *UI) StartUILoop() error {
339	signals := make(chan os.Signal, 1)
340	signal.Notify(
341		signals,
342		syscall.SIGHUP,
343		syscall.SIGINT,
344		syscall.SIGQUIT,
345		syscall.SIGILL,
346		syscall.SIGTRAP,
347		syscall.SIGABRT,
348		syscall.SIGPIPE,
349		syscall.SIGTERM,
350	)
351	defer signal.Stop(signals)
352
353	return ui.runUILoop(signals)
354}
355
356func (ui *UI) runUILoop(signals <-chan os.Signal) error {
357	stopSignals := make(chan struct{})
358	signalsDone := make(chan struct{})
359	go func() {
360		defer close(signalsDone)
361		ui.handleSignals(signals, stopSignals)
362	}()
363
364	err := ui.app.Run()
365	close(stopSignals)
366	<-signalsDone
367	return err
368}
369
370func (ui *UI) handleSignals(signals <-chan os.Signal, stop <-chan struct{}) {
371	for {
372		select {
373		case <-stop:
374			return
375		case current, ok := <-signals:
376			if !ok {
377				return
378			}
379			log.Printf("Got signal: %s", current)
380			ui.postSignalEvent(signalEvent(current), stop)
381		}
382	}
383}
384
385func (ui *UI) postSignalEvent(event *tcell.EventKey, stop <-chan struct{}) {
386	if err := ui.screen.PostEvent(event); err == nil {
387		return
388	}
389
390	retry := time.NewTicker(time.Millisecond)
391	defer retry.Stop()
392	for {
393		select {
394		case <-stop:
395			return
396		case <-retry.C:
397			if err := ui.screen.PostEvent(event); err == nil {
398				return
399			}
400		}
401	}
402}
403
404func signalEvent(current os.Signal) *tcell.EventKey {
405	modifiers := tcell.ModNone
406	if current == syscall.SIGINT {
407		modifiers = tcell.ModCtrl
408	}
409	return tcell.NewEventKey(tcell.KeyExit, 0, modifiers)
410}
411
412func (ui *UI) handleSignalEvent(event *tcell.EventKey) {
413	if event.Modifiers() == tcell.ModCtrl && (ui.cancelScan() || ui.scanning) {
414		return
415	}
416	ui.printMarkedPaths()
417	ui.app.Stop()
418}
419
420func (ui *UI) cancelScan() bool {
421	if !ui.scanning || ui.scanCancelled {
422		return false
423	}
424
425	ui.Analyzer.Cancel()
426	ui.scanCancelled = true
427	ui.progress.SetTitle(" Stopping scan... ")
428	ui.progress.SetText("Stopping scan and keeping results...")
429	return true
430}
431
432// SetConfirmQuit sets whether gdu asks for confirmation before quitting
433// after a scan that took a noticeable amount of time
434func (ui *UI) SetConfirmQuit(value bool) {
435	ui.confirmQuit = value
436}
437
438// SetShowItemCount sets the flag to show number of items in directory
439func (ui *UI) SetShowItemCount() {
440	ui.showItemCount = true
441}
442
443// SetShowMTime sets the flag to show last modification time of items in directory
444func (ui *UI) SetShowMTime() {
445	ui.showMtime = true
446}
447
448// SetShowSymlinkTarget enables displaying the symlink target (name -> target)
449func (ui *UI) SetShowSymlinkTarget(value bool) {
450	ui.showSymlinkTarget = value
451}
452
453// SetNoDelete disables all write operations
454func (ui *UI) SetNoDelete() {
455	ui.noDelete = true
456}
457
458// SetNoSpawnShell disables shell spawning
459func (ui *UI) SetNoSpawnShell() {
460	ui.noSpawnShell = true
461}
462
463func (ui *UI) SetNoViewFile() {
464	ui.noViewFile = true
465}
466
467// SetNoDelete disables delete when time filters are active
468func (ui *UI) SetNoDeleteWithFilter() {
469	ui.noDeleteWithFilter = true
470}
471
472// SetBrowseParentDirs enables navigating above the launch directory
473func (ui *UI) SetBrowseParentDirs() {
474	ui.browseParentDirs = true
475}
476
477// SetCollapsePath sets the flag to collapse paths
478func (ui *UI) SetCollapsePath(value bool) {
479	ui.collapsePath = value
480}
481
482// SetShowDiskProgressBar sets whether to show a progress bar when scanning a whole disk
483func (ui *UI) SetShowDiskProgressBar(value bool) {
484	ui.showDiskProgressBar = value
485}
486
487// SetDeleteInBackground sets the flag to delete files in background
488func (ui *UI) SetDeleteInBackground() {
489	ui.deleteInBackground = true
490
491	for i := 0; i < ui.deleteWorkersCount; i++ {
492		go ui.deleteWorker()
493	}
494	go ui.updateStatusWorker()
495}
496
497func (ui *UI) resetSorting() {
498	ui.sortBy = ui.defaultSortBy
499	ui.sortOrder = ui.defaultSortOrder
500}
501
502func (ui *UI) rescanDir() {
503	ui.linkedItems = make(fs.HardLinkedItems)
504	err := ui.AnalyzePath(ui.currentDirPath, ui.currentDir.GetParent())
505	if err != nil {
506		ui.showErr("Error rescanning path", err)
507	}
508}
509
510func (ui *UI) fileItemSelected(row, column int) {
511	if ui.currentDir == nil {
512		return // Add this check to handle nil case
513	}
514
515	selectedDirCell := ui.table.GetCell(row, column)
516
517	// Check if the selectedDirCell is nil before using it
518	if selectedDirCell == nil || selectedDirCell.GetReference() == nil {
519		return
520	}
521
522	selectedDir := selectedDirCell.GetReference().(fs.Item)
523	if selectedDir == nil || !selectedDir.IsDir() {
524		return
525	}
526
527	origDir := ui.currentDir
528	ui.currentDir = selectedDir
529	ui.hideFilterInput()
530	ui.hideTypeFilterInput()
531	ui.markedRows = make(map[int]struct{})
532	ui.ignoredRows = make(map[int]struct{})
533	ui.showDir()
534
535	// while previewing a mid-scan snapshot there is no stable top dir to anchor
536	// the "select last visited" logic to, so just render the navigated dir
537	if ui.previewing {
538		return
539	}
540
541	if row != 0 || origDir.GetPath() == ui.topDir.GetPath() {
542		return
543	}
544
545	// we are going up in the directory tree, select the last visited directory
546	if origDir.GetParent() != nil {
547		nestedDir := origDir
548		for nestedDir.GetParent() != nil {
549			if selectedDir.GetName() == nestedDir.GetParent().GetName() {
550				sortBy, sortOrder := ui.getSortParams()
551				index := -1
552				i := 0
553				for item := range ui.currentDir.GetFiles(sortBy, sortOrder) {
554					if item.GetName() == nestedDir.GetName() {
555						index = i
556						break
557					}
558					i++
559				}
560				if index >= 0 {
561					if ui.currentDir.GetPath() != ui.topDir.GetPath() {
562						index++
563					}
564					ui.table.Select(index, 0)
565				}
566				break
567			}
568			nestedDir = nestedDir.GetParent()
569		}
570	}
571}
572
573func (ui *UI) deviceItemSelected(row, column int) {
574	var err error
575	selectedDevice, ok := ui.table.GetCell(row, column).GetReference().(*device.Device)
576	if !ok {
577		return
578	}
579
580	paths := device.GetNestedMountpointsPaths(selectedDevice.MountPoint, ui.devices)
581	ui.IgnoreDirPathPatterns, err = common.CreateIgnorePattern(paths)
582	if err != nil {
583		log.Printf("Creating path patterns for other devices failed: %s", paths)
584	}
585
586	ui.resetSorting()
587
588	ui.currentDeviceSize = selectedDevice.Size
589	ui.Analyzer.ResetProgress()
590	ui.linkedItems = make(fs.HardLinkedItems)
591	err = ui.AnalyzePath(selectedDevice.MountPoint, nil)
592	if err != nil {
593		ui.showErr("Error analyzing device", err)
594	}
595}
596
597func (ui *UI) confirmDeletion(action DeleteAction) {
598	if ui.noDelete {
599		previousHeaderText := ui.header.GetText(false)
600
601		// show feedback to user
602		ui.header.SetText(" Deletion is disabled!")
603
604		go func() {
605			time.Sleep(2 * time.Second)
606			ui.app.QueueUpdateDraw(func() {
607				ui.header.Clear()
608				ui.header.SetText(previousHeaderText)
609			})
610		}()
611
612		return
613	}
614
615	// Check if deletion is allowed with active time filters
616	if ui.noDeleteWithFilter {
617		modal := tview.NewModal().
618			SetText("Deletion is disabled when a time filter is active.\n\n" +
619				"To override, set GDU_ALLOW_DELETE_WITH_FILTER=1").
620			AddButtons([]string{"OK"}).
621			SetDoneFunc(func(buttonIndex int, buttonLabel string) {
622				ui.pages.RemovePage("confirm")
623			})
624		if !ui.UseColors {
625			modal.SetBackgroundColor(tcell.ColorGray)
626		}
627		ui.pages.AddPage("confirm", modal, true, true)
628		return
629	}
630
631	if len(ui.markedRows) > 0 {
632		ui.confirmDeletionMarked(action)
633	} else {
634		ui.confirmDeletionSelected(action)
635	}
636}
637
638func (ui *UI) confirmDeletionSelected(action DeleteAction) {
639	row, column := ui.table.GetSelection()
640	selectedFile := ui.table.GetCell(row, column).GetReference().(fs.Item)
641	modal := tview.NewModal().
642		SetText(
643			"Are you sure you want to " +
644				action.Verb() +
645				" \"" +
646				tview.Escape(selectedFile.GetName()) +
647				"\"?",
648		).
649		AddButtons([]string{"no", "yes", "don't ask me again"}).
650		SetDoneFunc(func(buttonIndex int, buttonLabel string) {
651			switch buttonIndex {
652			case 2:
653				ui.askBeforeDelete = false
654				fallthrough
655			case 1:
656				ui.deleteSelected(action)
657			}
658			ui.pages.RemovePage("confirm")
659		})
660
661	if !ui.UseColors {
662		modal.SetBackgroundColor(tcell.ColorGray)
663	} else {
664		modal.SetBackgroundColor(tcell.ColorBlack)
665	}
666	modal.SetBorderColor(tcell.ColorDefault)
667
668	ui.pages.AddPage("confirm", modal, true, true)
669}
670
671// SetTimeFilterWithInfo sets both the time filter function and stores the filter info for display
672func (ui *UI) SetTimeFilterWithInfo(tf *timefilter.TimeFilter, loc *time.Location) {
673	ui.timeFilter = tf
674	ui.timeFilterLoc = loc
675
676	if tf != nil && !tf.IsEmpty() {
677		timeFilterFunc := func(mtime time.Time) bool {
678			return tf.IncludeByTimeFilter(mtime, loc)
679		}
680		ui.SetTimeFilter(timeFilterFunc)
681		if !ui.isDeleteAllowedWithFilter() {
682			ui.SetNoDeleteWithFilter()
683		}
684	}
685}
686
687// hasActiveTimeFilter returns true if any time filter is active
688func (ui *UI) hasActiveTimeFilter() bool {
689	return ui.timeFilter != nil && !ui.timeFilter.IsEmpty()
690}
691
692// formatTimeFilterInfo formats the time filter information for display
693func (ui *UI) formatTimeFilterInfo() string {
694	if !ui.hasActiveTimeFilter() {
695		return ""
696	}
697
698	return ui.timeFilter.FormatForDisplay(ui.timeFilterLoc)
699}
700
701// isDeleteAllowedWithFilter checks if deletion is allowed when filters are active
702func (ui *UI) isDeleteAllowedWithFilter() bool {
703	if !ui.hasActiveTimeFilter() {
704		return true
705	}
706
707	// Check environment variable override
708	if os.Getenv("GDU_ALLOW_DELETE_WITH_FILTER") == "1" {
709		return true
710	}
711
712	return false
713}
714
715// sanitizePathForDisplay replaces control characters (which can include
716// terminal escape sequences) with the Unicode replacement character. A
717// scanned directory entry's name has no character restrictions, and these
718// paths are printed to the real terminal after the tview screen has
719// stopped, bypassing tview's own protective rendering entirely.
720func sanitizePathForDisplay(s string) string {
721	return strings.Map(func(r rune) rune {
722		if unicode.IsControl(r) {
723			return '�'
724		}
725		return r
726	}, s)
727}
728
729// printMarkedPaths prints the paths of the marked items to the output
730func (ui *UI) printMarkedPaths() {
731	for _, path := range ui.markedPaths {
732		fmt.Fprintf(ui.output, "%s\n", sanitizePathForDisplay(path))
733	}
734}