Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cwd #7

Merged
merged 3 commits into from
Jun 10, 2018
Merged

Cwd #7

merged 3 commits into from
Jun 10, 2018

Commits on May 14, 2018

  1. [README] minor fixes

    Yves Simenya committed May 14, 2018
    Configuration menu
    Copy the full SHA
    0dee5fc View commit details
    Browse the repository at this point in the history
  2. Add cwd option to LocalShell

    Rationnal:
    ==========
    
    I found myself writing code like this:
    
        shell = LocalShell()
        os.chdir(first_custom_path)
        shell('first_command')
        os.chdir(second_custom_path)
        shell('second_command')
    
    I didn't like it!
    Shell is built upon Popen.
    It's cwd paramater allows to set a custom path.
    With this option avalaible on LocalShell object,
    I can then change the code to:
    
        shell = LocalShell()
        shell('first_command', cwd=first_custom_path)
        shell('second_command', cwd=second_custom_path)
    
    Better ;-)
    
    Remark:
    ======
    
    I was tempted to make cwd persitant so that code like this:
    
        shell = LocalShell(cwd=custom_path)
        shell('first_command')
        shell('second_command')
    
    runs commands in "custom_path".
    But I find it a bit hard to read.
    I will have to go back and forth from object instantiation to shell command
    to figure out from where those are run.
    So I didn't go any further this way!
    Yves Simenya committed May 14, 2018
    Configuration menu
    Copy the full SHA
    966d2ec View commit details
    Browse the repository at this point in the history
  3. Cleanup

    Yves Simenya committed May 14, 2018
    Configuration menu
    Copy the full SHA
    5a33f0a View commit details
    Browse the repository at this point in the history