🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

reploncli

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reploncli

REPL extension to CLI apps

0.9.4
PyPI
Maintainers
1

REPL on CLI

REPL extension to CLI apps

Example

import sys
from reploncli import reploncli

import my_cli_function, show_help

# turn on REPL mode if the first command line argument is 'repl'
lets_start_in_repl_mode = (sys.argv[1:] or [''])[0] == "repl"

reploncli(my_cli_function, lets_start_in_repl_mode, show_help, ">>> ")

reploncli()

Signature:

def reploncli(cli_function, repl_mode=None, help=None, prompt=""):
    ...

If repl_mode is True then REPL mode starts.

Wrap your CLI entry point

Create cli_function by wrapping your CLI entry point that accepts one optional argument with args to use as a replacement for sys.argv if given.
Otherwise process sys.argv as normal.

Shell commands

If an input in REPL mode starts with . then it's run by os.system() after removing that dot.

Keywords

repl

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts