/// <summary> /// Writes a collection of item for selecting. /// </summary> /// <param name="cli">The command line interface proxy.</param> /// <param name="collection">The collection data.</param> /// <param name="options">The selection display options.</param> /// <returns>The result of selection.</returns> public static SelectionResult <T> Select <T>(this StyleConsole cli, IEnumerable <SelectionItem <T> > collection, SelectionConsoleOptions options = null) { var c = new SelectionData <T>(); c.AddRange(collection); return(Select(cli, c, options)); }
/// <summary> /// Writes a collection of item for selecting. /// </summary> /// <param name="cli">The command line interface proxy.</param> /// <param name="collection">The collection data.</param> /// <param name="options">The selection display options.</param> /// <returns>The result of selection.</returns> public static SelectionResult <string> Select(this StyleConsole cli, IEnumerable <string> collection, SelectionConsoleOptions options = null) { if (collection == null) { return(null); } if (cli == null) { cli = StyleConsole.Default; } if (options == null) { options = new(); } else { options = options.Clone(); } cli.Flush(); var c = new SelectionData <string>(); c.AddRange(collection); if (cli.Handler == null && cli.Mode == StyleConsole.Modes.Text) { return(SelectForText(cli, c, options)); } return(Select(cli, c, options, 0)); }