ksc010
V2EX  ›  问与答

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

  •  
  •   ksc010 · Feb 11, 2014 · 6013 views
    This topic created in 4483 days ago, the information mentioned may be changed or developed.
    命令执行后可以进入自己单独的“shell”-
    Supplement 1  ·  Feb 11, 2014
    效果类似 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 replies    1970-01-01 08:00:00 +08:00
    hiwljun
        1
    hiwljun  
       Feb 11, 2014   ❤️ 1
    fabric
    iptux
        2
    iptux  
       Feb 11, 2014   ❤️ 1
    import cmd
    evefree2
        3
    evefree2  
       Feb 11, 2014   ❤️ 1
    pexpect
    ksc010
        4
    ksc010  
    OP
       Feb 11, 2014
    感谢各位
    @hiwljun
    @evefree2
    可能“交互效果”表达的不是很清楚 上面又举了个例字

    @iptux
    可能是这个 待会研究下先
    CMGS
        5
    CMGS  
       Feb 11, 2014
    自己写啊。。
    raw_input读就好了,实在要高大上比如补全啥的,python有个包就是干着活的不过我得找找,忘记了擦= =
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2779 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 01:12 · PVG 09:12 · LAX 18:12 · JFK 21:12
    ♥ Do have faith in what you're doing.