-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
224 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,44 @@ trzsz-ssh ( tssh ) offers additional useful features: | |
- Download from the [GitHub Releases](https://github.com/trzsz/trzsz-ssh/releases), unzip and add to `PATH` environment. | ||
## Development | ||
The `github.com/trzsz/trzsz-ssh/tssh` can be used as a library, for example: | ||
```go | ||
package main | ||
import ( | ||
"log" | ||
"os" | ||
"github.com/trzsz/trzsz-ssh/tssh" | ||
) | ||
func main() { | ||
// Example 1: execute command on remote server | ||
client, err := tssh.SshLogin(&tssh.SshArgs{Destination: "[email protected]"}) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
defer client.Close() | ||
session, err := client.NewSession() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
defer session.Close() | ||
output, err := session.CombinedOutput("whoami") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Printf("I'm %s", string(output)) | ||
// Example 2: run the tssh program | ||
code := tssh.TsshMain([]string{"-t", "[email protected]", "bash -l"}) | ||
os.Exit(code) | ||
} | ||
``` | ||
## Contributing | ||
Welcome and thank you for considering contributing. We appreciate all forms of support, from coding and testing to documentation and CI/CD improvements. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,5 @@ import ( | |
) | ||
|
||
func main() { | ||
os.Exit(tssh.TsshMain()) | ||
os.Exit(tssh.TsshMain(os.Args[1:])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.