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

Why was the cd() function removed? #177

Closed
tomzx opened this issue Feb 14, 2015 · 4 comments
Closed

Why was the cd() function removed? #177

tomzx opened this issue Feb 14, 2015 · 4 comments
Milestone

Comments

@tomzx
Copy link
Contributor

tomzx commented Feb 14, 2015

I think that the following syntax is much nicer than the second one.

cd('{some_path}');
run('my_super_command'); // in {some_path}
run('cd {some_path} && my_super_command');

Thus my question: why was cd() removed in v3?

@antonmedv
Copy link
Member

I removed cd function to simplify run function. I think run('cd {some_path} && my_super_command') more readable than. But if is possible to bring back cd function.

@tomzx
Copy link
Contributor Author

tomzx commented Feb 14, 2015

Most tasks generally occur within a specific directory. I think the cd syntax follows the DRY (Don't Repeat Yourself) principle which is a good thing. Furthermore, since your preference (cd-ing on every command) still would work with cd support, it would probably be better to have it than not.

cd('{some_path}');
run('my_super_command');
run('my_super_command');
run('my_super_command');
run('my_super_command');
run('cd {some_path} && my_super_command');
run('cd {some_path} && my_super_command');
run('cd {some_path} && my_super_command');
run('cd {some_path} && my_super_command');

I do understand that the removal of cd (and the working path paradigm) was to simplify the run function. I guess the problem is that the phpseclib (and I assume the ssh2 extension) both run one-off commands where you are back to the home directory after each command, which means if we want emulate a working directory, we have to do it ourselves.

@antonmedv
Copy link
Member

Ok, will bring back cd func. 👍

@antonmedv
Copy link
Member

cd is back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants