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

repl::ReplSession::new function is private #31

Closed
yamaura opened this issue May 10, 2022 · 5 comments
Closed

repl::ReplSession::new function is private #31

yamaura opened this issue May 10, 2022 · 5 comments

Comments

@yamaura
Copy link

yamaura commented May 10, 2022

Thanks for the wonderful library.
I want to create my custom ReplSession, but ReplSession::new function is private. So how can I create ReplSession from some sessions outside of this library?

I want to run program following:

let session = expectrl::repl::ReplSession::new(
    expectrl::spawn("mycommand").unwrap(),
    "EXPECT_PROMPT".to_string(),
    None, false);
let recv = session.execute("send");
@zhiburt
Copy link
Owner

zhiburt commented May 10, 2022

Hi @yamaura thank you for opening the issue.

I think you're right we can make it public.

@zhiburt
Copy link
Owner

zhiburt commented May 10, 2022

I think it was private because it was suppose to be a rare case when someone would use it.

Can I ask you what process you're spawning?

@zhiburt
Copy link
Owner

zhiburt commented May 10, 2022

Do you need it to be published, soon?

I think we need to do #32 and then we could release the new version.

@yamaura
Copy link
Author

yamaura commented May 11, 2022

Sorry for the lack of explanation.
Currently, I'm working on creating lib to log in automatically and then do one shot command.
I thought it would be easier if I could use ReplSession, which is already implemented since I would have to use some repl cli at the remote.

So really I want to like this:

let session = expectrl::spawn("telnet remote").unwrap();
// session.expect("login:)....
// Do something log in procedure here
// It depends on remote machine, *nix, switches, special hardware and so on.
let session = expectrl::repl::ReplSession::new(session, "EXPECT_PROMPT".to_string(), None, false);
let recv = session.execute("send");

No problem, as I am in no hurry to publish it.
Thanks.

@zhiburt
Copy link
Owner

zhiburt commented May 12, 2022

released in 0.4.0

please open an issue if there any more ones.

Thank you once again to addressing it.

@zhiburt zhiburt closed this as completed May 12, 2022
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