Git Product home page Git Product logo

riposte's People

Contributors

danizaha avatar fwkz avatar wmshort 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  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  avatar  avatar  avatar  avatar  avatar

riposte's Issues

improve Windows compatibility

readline prevents compatibility with Windows; pyreadline could be used as a drop-in replacement with a conditional import

"UnboundLocalError" when trying to get a previously initialized list

Following code

from riposte import Riposte

mainrepl = Riposte(prompt="repl:~$ ")
DATA = []
@mainrepl.command("add")
def add(x: str):
	DATA += x
@mainrepl.command("get")
def get():
	mainrepl.success(DATA)
mainrepl.run()

Gives me

$python3 riposte_test.py
repl:~$ add foo
Traceback (most recent call last):
  File "riposte_test.py", line 15, in <module>
    mainrepl.run()
  File "/home/user/.local/lib/python3.7/site-packages/riposte/riposte.py", line 241, in run
    self._process()
  File "/home/user/.local/lib/python3.7/site-packages/riposte/riposte.py", line 228, in _process
    self._get_command(command_name).execute(*args)
  File "/home/user/.local/lib/python3.7/site-packages/riposte/command.py", line 106, in execute
    return self._func(*self._apply_guides(self._bind_arguments(*args)))
  File "riposte_test.py", line 9, in add
    DATA += x
UnboundLocalError: local variable 'DATA' referenced before assignment

Any class methods (for example, “assign” to a list) works fine.
Am I missing something? I can't find answer in docs.

$python3 -V
Python 3.7.3rc1

asyncio support?

This looks like a convenient tool! I'm curious what support it has for asyncio and if it doesn't have it, perhaps this could be an feature request asking for it.

Default command option

Would it be possible to add a default command option? I'm running into a situation where I'd like to have a default command case be shelling out to a remote server.

This could be represented as a decorator like:

@shell.default
def shell_out(command: str):
    remote.execute(command)

Per-command parsing mode?

Would it be feasible (and sensical) to implement a per-command switch to specify parsing mode? In some instances it would be helpful to be able to process command arguments as raw rather than parsed tokenized strings (or even as string literals), including preserving double and single quotes. I mean something like the difference between the two commands in this fabricated example:

riposte ~$ echo "This is a string literal"
This is a string literal
riposte ~$ raw "This" 'is' a 'raw' "string"
"This" 'is' a 'raw' "string"

shlex.split()'s posix argument seems like it might be part of a solution. Ideally the mode switch could be available as a parameter when declaring a Command, or perhaps as part of guides?

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.