public DirectoryTableView(DirectoryInfo directory) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } Add(new ContentView("\n")); Add(new ContentView(Span($"Directory: {directory.FullName.Rgb(235, 30, 180)}"))); Add(new ContentView("\n")); var tableView = new TableView <FileSystemInfo>(); tableView.Items = directory.EnumerateFileSystemInfos() .OrderByDescending(f => f is DirectoryInfo) .ToList(); tableView.AddColumn( cellValue: f => f is DirectoryInfo ? f.Name.LightGreen() : f.Name.White(), header: new ContentView("Name".Underline())); tableView.AddColumn( cellValue: f => Span(f.CreationTime), header: new ContentView("Created".Underline())); tableView.AddColumn( cellValue: f => Span(f.LastWriteTime), header: new ContentView("Modified".Underline())); Add(tableView); Formatter.AddFormatter <DateTime>(d => $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}"); }
public static ContainerSpan StyleUnimportant(this string @string) { return(new ContainerSpan( ForegroundColorSpan.DarkGray(), new ContentSpan(@string), ForegroundColorSpan.Reset())); }
/// <summary> /// Initializes this instance. /// </summary> /// <autogeneratedoc/> public virtual void Initialize() { string authentication; if (string.IsNullOrWhiteSpace(options.PersonalAccessToken)) { authentication = "Windows"; } else { authentication = "Personal access token"; } Add(new ContentView("\n")); Add(new ContentView(Span($"DevOps Remaining Work Query V{Assembly.GetExecutingAssembly().GetName().Version}".Orange()))); Add(new ContentView(Span($"Jérôme Piquot".DarkOrange()))); Add(new ContentView(Span($"Use the --help option for more informations.".DarkGrey()))); Add(new ContentView("\n")); Add(new ContentView(Span($"Server: {options.Server?.DarkGrey()}"))); Add(new ContentView(Span($"Project: {options.Project?.DarkGrey()}"))); Add(new ContentView(Span($"Query: {options.Query?.DarkGrey()}"))); Add(new ContentView(Span($"Ouput file: {options.OutputFile?.DarkGrey()}"))); Add(new ContentView(Span($"Culture: {options.Culture?.DarkGrey()}"))); Add(new ContentView(Span($"Area path: {options.AreaPath?.DarkGrey()}"))); Add(new ContentView(Span($"Iteration path: {options.IterationPath?.DarkGrey()}"))); Add(new ContentView(Span($"Authentication: {authentication.DarkGrey()}"))); Add(new ContentView(Span($"Activity order: {string.Join(',', options.ActivityOrder ?? new List<string>()).DarkGrey()}"))); Add(new ContentView(Span($"Parent max depth: {options.ParentDepth?.ToString().DarkGrey()}"))); Add(new ContentView("\n")); Formatter.AddFormatter <DateTime>(d => $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}"); }
public DirectoryView(DirectoryInfo directory) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } var formatter = new SpanFormatter(); formatter.AddFormatter <DateTime>(d => $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}"); Add(new ContentView("")); Add(new ContentView("")); Add(new ContentView($"Directory: {directory.FullName}")); Add(new ContentView("")); Add(new ContentView("")); var directoryContents = directory.EnumerateFileSystemInfos() .OrderBy(f => f is DirectoryInfo ? 0 : 1).ToList(); var tableView = new TableView <FileSystemInfo>(); tableView.Items = directoryContents; tableView.AddColumn(f => f is DirectoryInfo ? Span($"{ForegroundColorSpan.LightGreen()}{f.Name} ") : Span($"{ForegroundColorSpan.White()}{f.Name} "), new ContentView(formatter.ParseToSpan($"{Ansi.Text.UnderlinedOn}Name{Ansi.Text.UnderlinedOff}"))); tableView.AddColumn(f => formatter.Format(f.CreationTime), new ContentView(formatter.ParseToSpan($"{Ansi.Text.UnderlinedOn}Created{Ansi.Text.UnderlinedOff}"))); tableView.AddColumn(f => formatter.Format(f.LastWriteTime), new ContentView(formatter.ParseToSpan($"{Ansi.Text.UnderlinedOn}Modified{Ansi.Text.UnderlinedOff}"))); Add(tableView); Span Span(FormattableString formattableString) { return(formatter.ParseToSpan(formattableString)); } }
public virtual void Initialize() { Add(new ContentView("\n")); Add(new ContentView(Span($"Sql backup utility V{Assembly.GetExecutingAssembly().GetName().Version}".Orange()))); Add(new ContentView(Span($"Jérôme Piquot".DarkOrange()))); Add(new ContentView("\n")); Add(new ContentView(Span($"Command: {string.Join("; ", _options.Command).White()}"))); Add(new ContentView(Span($"Sql server: {string.Join("; ", _options.Server).DarkGrey()}"))); Add(new ContentView("\n")); Add(new ContentView(Span($"Backup directories: {string.Join("; ", _options.BackupDirectories).DarkGrey()}"))); Add(new ContentView(Span($"Include sub directories: {_options.IncludeSubDirectories.ToString().DarkGrey()}"))); Add(new ContentView(Span($"Backup extensions: {string.Join("; ", _options.BackupExtensions).DarkGrey()}"))); Add(new ContentView(Span($"Backup type: {_options.BackupType.ToString().DarkGrey()}"))); Add(new ContentView(Span($"Source server: {_options.SourceServer?.ToString().DarkGrey()}"))); Add(new ContentView(Span($"Source database: {_options.SourceDatabase?.ToString().DarkGrey()}"))); Add(new ContentView(Span($"Before: {_options.Before?.ToString(CultureInfo.CurrentCulture).DarkGrey()}"))); AddSummaryInformation(); if (_backups.Any()) { Add(_tableView); AddTableInformation(); } Formatter.AddFormatter <DateTime>(d => $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}"); }
public void FormatSpans_do_not_have_default_string_representations() { $"{ForegroundColorSpan.DarkGray()}The {BackgroundColorSpan.Cyan()}quick{StyleSpan.BlinkOn()} brown fox jumped over the lazy dog.{StyleSpan.BoldOff()}{ForegroundColorSpan.Reset()}{BackgroundColorSpan.Reset()}" .Should() .Be("The quick brown fox jumped over the lazy dog."); }
internal static FormattableString Gray(this string message) { return($"{ForegroundColorSpan.DarkGray()}{message}{ForegroundColorSpan.Reset()}"); }