V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ksc010
V2EX  ›  问与答

Python如何实现类似于ftp,ssh,python 命令那样的交互式效果?

  •  
  •   ksc010 · 2014-02-11 10:38:03 +08:00 · 5290 次点击
    这是一个创建于 3746 天前的主题,其中的信息可能已经有所发展或是发生改变。
    命令执行后可以进入自己单独的“shell”-
    第 1 条附言  ·  2014-02-11 12:58:12 +08:00
    效果类似 gitsh https://github.com/thoughtbot/gitsh
    gitsh 开始一个 git 操作的 SHELL 环境,用以替代原有命令行的操作方式,例如一般 git 的操作方式是:

    $ git status
    $ git add -p
    $ git commit
    $ git push
    而使用 gitsh 的操作方式是:

    $ gitsh
    gitsh@ status
    gitsh@ add -p
    gitsh@ commit
    gitsh@ push
    gitsh@ :exit
    $
    5 条回复    1970-01-01 08:00:00 +08:00
    hiwljun
        1
    hiwljun  
       2014-02-11 11:11:42 +08:00   ❤️ 1
    fabric
    iptux
        2
    iptux  
       2014-02-11 11:14:50 +08:00   ❤️ 1
    import cmd
    evefree2
        3
    evefree2  
       2014-02-11 11:15:23 +08:00   ❤️ 1
    pexpect
    ksc010
        4
    ksc010  
    OP
       2014-02-11 13:02:24 +08:00
    感谢各位
    @hiwljun
    @evefree2
    可能“交互效果”表达的不是很清楚 上面又举了个例字

    @iptux
    可能是这个 待会研究下先
    CMGS
        5
    CMGS  
       2014-02-11 13:07:39 +08:00
    自己写啊。。
    raw_input读就好了,实在要高大上比如补全啥的,python有个包就是干着活的不过我得找找,忘记了擦= =
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   6240 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 02:35 · PVG 10:35 · LAX 19:35 · JFK 22:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.