Giter VIP home page Giter VIP logo

promptplus's People

Contributors

fracerqueira avatar ividyon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

promptplus's Issues

Exception trying to filter Select prompt + some general questions

Hi,

I'm still continuing with my usage of PromptPlus, and continuing to stumble on new issues. I assume I am doing something wrong.

The code can be found here.

When I press any key, the Select seems to enter a "filter" mode. However, if I enter a string which does not exist in the options, I get the following exception:

2023-09-13_19-11-57__WindowsTerminal

  1. How to resolve that error? Did I misconfigure something or is it a bug?
  2. Can I disable the filter function? It's not needed in this case.
  3. Can I disable other display functions, such as the "Choose an option:" prompt? The color highlighting of the selected option in the list is enough for me.

Split feature Control Table

PromptPlus.TableSelect to Select item in table : Select row, column and data in a grid/table

PromptPlus.Table to write table in console : Show data in a grid/table

NEW CONTROL : Pipeline

Run a conditional pipeline for each pipe with the ability to redirect/cancel the flow sequence

Square brackets in Select option strings cause error

I tried doing the following:

    private static List<string> ConfigOptions()
    {
        List<string> list = new();

        list.Add(WitchyConfiguration.Bnd ? "[x] BND" : "[ ] BND");
        list.Add(WitchyConfiguration.Dcx ? "[x] DCX" : "[ ] DCX");

        return list;
    }

    public static void CliConfigMode(CliOptions opt)
    {
        var select = PromptPlus.Select<string>("Select");
        select.Interaction(ConfigOptions(), (select, s) => { select.AddItem(s); });
        select.Run();
    }

This led to the following error:

PPlus.PromptPlusException: Could not find color or style ''.
   at PPlus.Drivers.StyleParser.Parse(String text, Overflow overflow)
   at PPlus.Drivers.Segment.Parse(String text, Style style)
   at PPlus.Drivers.ConsoleDriveWindows.Write(String value, Nullable`1 style, Boolean clearrestofline)
   at PPlus.Controls.Objects.BaseControl`1.RenderBuffer()
   at PPlus.Controls.Objects.BaseControl`1.Start(CancellationToken stoptoken)
   at PPlus.Controls.Objects.BaseControl`1.Run(Nullable`1 stoptoken)

Removing the brackets from the strings fixed the problem.

P.S.: Is there a better way in PromptPlus to do toggleable checkboxes like this?

No copyright notice exists for the source code being copied and used

I am tired of pointing out license violations as I have done before, but there is no copyright notice for code copied from my public library (published under the MIT License). This is not in accordance with the MIT License.

I consider the statement "inspired by" to be quite different from a copyright notice. In fact, it is just a copy.

New Control : TableMultSelect<T> : Select multi-data in a grid/table

Ex:
var tbl = PromptPlus.TableMultiSelect("Your Prompt", "Descripion Table")
.AddItems(data)
.AutoFill(0, 80)
.AddFormatType(FmtDate)
.Templates(
selectedTemplate: (item) => $"Current Selected: [yellow]{item.Count()}[/]",
finishTemplate: (item) => $"[green]Selected: {item.Count()}[/]")
.Run();

Exception when returning to a Select

With the following reproduction code:

using System.ComponentModel.DataAnnotations;
using System.Globalization;
using PPlus;

namespace ERMovesetTool;

public static class Reproduce
{
    internal enum Modes
    {
        [Display(Name = "String 1")]
        A,
        [Display(Name = "String 2")] B,

        [Display(Name = "String 3")]
        C,
    }
    public static void Do()
    {
        //Ensure ValueResult Culture for all controls
        PromptPlus.Config.DefaultCulture = new CultureInfo("en-us");

        PromptPlus.Banner("Banner").Run();

        while (true)
        {
            PromptPlus.DoubleDash("Double Dash String");
            PromptPlus.SingleDash("Single Dash String");

            var select = PromptPlus.Select<Modes>("Select operation")
                .Run();
            if (!select.IsAborted)
            {
                switch (select.Value)
                {
                    case Modes.A:
                        PromptPlus.DoubleDash("Double Dash String");

                        PromptPlus.WriteLine("String");
                        var anyKey = PromptPlus.KeyPress().Run();
                        break;
                    case Modes.B:
                        break;
                    case Modes.C:
                        break;
                }
            }

            PromptPlus.DoubleDash("Double Dash String");
            var repeat = PromptPlus.Confirm("Confirm?").Run();
            if (repeat.IsAborted || repeat.Value.IsNoResponseKey())
                break;
        }
    }
}

Upon building and publishing the code, and running the EXE, if I perform the following actions:

  1. Select operation "String 1"
  2. Press any key
  3. Confirm with Y
  4. Press Arrow Down to select another operation

I get the following exception:

2023-08-11_02-39-10

This doesn't seem to happen if I run the app in the IntelliJ Rider "Run" terminal window, only if running the EXE (with Windows Terminal in Windows 11).

Running PromptPlus.Clear() at the start of the while(true) loop seems to avoid the problem.

More output functions for PromptPlus.Error

I noticed that PromptPlus.Error seems to only support WriteLine in terms of output. However PromptPlus has other interesting methods, such as Write, DoubleDash, SingleDash etc. I believe those should also be supported for the outerr stream.

Cannot delete characters in Input element

I have the following code:

                    var input = PromptPlus.Input("Input new delay (in milliseconds)")
                        .AcceptInput(char.IsNumber)
                        .AddValidators(PromptValidators.IsTypeUInt16("Input is not within valid range"))
                        .ValidateOnDemand()
                        .Run();

I noticed that I cannot press Backspace, or use the arrow keys to move left/right in this input window. I have to press Esc to cancel out of the whole input and try again, if I make a typo. It's only possible to input characters, not remove characters.

Escaping format characters (by default)

I'm having some trouble with how PromptPlus automatically formats characters in strings.

My program is processing files such as C[c4201]_break.matbin. When processing them, it prints them to the console:

                                PromptPlus.WriteLine($"Unpacking {parser.Name}: {fileName}...");

So, when [] is contained in the file name, PromptPlus stumbles and throws an exception due to applying internal formatting to this somehow, which I can't seem to find in the docs.

It would be quite nice if it was possible to disable this formatting; on a per-function-call basis, as well as as a global configuration that will automatically escape any formatting in strings entered in any WriteLine (and similar functions).

For starters, I'd like to know how to manually escape such characters, for now.

Separators in Select?

Is it possible to have "separator" lines in Select elements?

2023-09-18_20-10-32__WindowsTerminal

In this example, I'd like to have, for example, a dash line between the "Toggle" options and the others, which cannot be selected (the select would just hop over it to the next one).

  Toggle option A
> Toggle option B
  Toggle option C
  ---------------
  Menu option A
  Menu option B
  Menu option C

Display data in a grid/table

A feature request. Would be nice to be able key/value pairs (and similar data) in columns with fixed width depending on the content.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.