Giter Club home page Giter Club logo

commandline's People

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  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  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

commandline's Issues

Remove is_interactive() from InteractiveBackend

The InteractiveBackend is only used if is_interactive() returns true, so there's no need to check for that in the implementation anymore.

  • Remove is_interactive uses from InteractiveBackend

GNU `screen -dmS` causes commandline to break and CPU spin

  1. Run commandline_test as screen -dmS test commandline_test
  2. Observe 100% CPU spin
  3. Attach via screen -r test and observe completely bugged input
  • screen -dmS should work as expected
  • there should be no CPU spin possible

Notes

  • it may be that isatty() changes after initialization(?)

CMP0037 - The target name "test" is reserved when CTest testing is enabled.

In CMakelists.txt - line 23.

if(BUILD_EXAMPLES)`
    add_executable(test main.cpp)
    target_link_libraries(test commandline)
    set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT test)
endif()

The target "test" is reserved and will cause cmake to fail configuration when CTest testing is enabled.

CMP0037

Suggest changing the target name.

Thank you for the commandline library!

History is broken on windows

When pressing Up-Arrow on the keyboard, the last entered command should appear. Pressing this repeatedly will go through all entered commands in the current session in reverse-chronological order. Down-Arrow then should do the opposite, ending up at the current prompt.

It doesn't do this properly on (all?) windows machines (CMD).

Use WinAPI functions on Windows

Currently we're using ANSI escape codes on both Unix/Linux/MacOS and Windows, which causes issues in Windows (of course).

They decided that Powershell and the Windows Terminal (!= CMD) should not behave properly when presented with ANSI escape codes, even with that feature explicitly enabled.

So, instead of getting really angry with windows' decisions, we are just going to use their WinAPI features to do what we do with ANSI escape sequences currently.

Snarkiness aside, the goal is to replace all ANSI escape codes (\0x1b prefixed stuff in all calls to printf) with the equivalent Windows API function call.

Allow other backends

  • Split the commandline class into frontend and backend
  • Implement a new backend for buffered input with no handling
  • Switch to this new backend if isatty() is false

Add prompts

Hi!

Nice library right here!

I wonder if it is possible to have some text prompting the user to input something.

Handle implementation defined behavior on input etc

Currently, calling get_command without checking has_command invokes implementation defined behavior (i.e. in both currently present backends an exception).

  • Find all cases in the code where such assumptions are made
  • Check and handle such errors
  • Come up with a uniform and clean way to handle such errors

Set cursor position from on_autocomplete callback

on_autocomplete currently passes in the current cursor position, in order to allow autocomplete within a word/sentence at a specific point. This is nice, but not as useful as it could be, because the cursor will end up at the end of the autocompletion, which is the end of the entire input.

We need a way to set the cursor's position generally, like c.set_cursor_position(), but it also has to be understood by the caller of on_autocomplete whether or not this has been called. If it was called, dont put the cursor at the end, and if it wasn't, do.

Rewrite CMakeLists

The current CMakeLists has a few bad decisions, the wrong version requirement, and a few other issues.

Rewrite it to make it conform to a newer standard, while going down in required version number (to support older codebases, see #10).

Move to C++11

The codebase does not require modern C++ (14, 17), as far as I can see. I'd like to see us move all code to C++11, and enforce this in the CMakeLists.

As a result, commandline can be integrated into more C++ projects.

Cursor left-right movement

This is partially supported already, just needs to be implemented. The idea is moving the cursor via left & right arrow keys. See m_cursor_pos for this.

atexit woes

Hey, nice library. I am wondering if it makes sense to move the atexit function restoring termios to just the destructor of the commandline? I have a server that handles SIGINT in order to gracefully store stuff to disk and then immediately _exit in order to avoid having to tearing down multi-gigabytes of structures. Guess it's just one of those weird cases.

For now I am just calling the atexit handler in the destructor ๐Ÿ‘

Input line wrapping

The library should figure out how long the terminal line is (or similar) and wrap long lines properly. Currently, long input lines are mostly broken.

Make delete key work

Currently, the delete key does not work. This wasn't implemented originally, because cursor movement didn't exist.

  • Find out what the escape sequence is for Delete on Windows+Linux
  • Implement removal of a character when Delete is pressed

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.