Skip to content
camphiPublic

About

Bring your tools to your SSH session

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cosse

Bring your tools to your SSH session

Install

git clone --depth 1 https://github.com/camphi/cosse.git ~/.cosse
ln -s ~/.cosse/cosse ~/bin/

Usage

Usage: cosse [options] [--] [command...]

Generates a base64-encoded remote payload to pass local functions,
environment variables and scripts over SSH. (Bash) (Not safe for secrets)
Stdin and [command...] are encapsulated to be executed at the end.

Options:
  -s, --source <file>   Source a local file (e.g., ~/.bash_aliases) before exporting.
  -a, --alias <name>    Export a specific alias by name.
  -f, --func <name>     Export a specific local function by name.
  -v, --var <name>      Export a specific local environment variable by name.
  -x, --script <file>   Transfer a local script to a remote temp dir, and add to $PATH.
  -e, --extra <file>    Transfer a local file to a remote temp dir. (COSSE_EXTRA)
  -i, --interactive     Force remote bash to spawn an interactive shell.
  -l, --login           Force remote bash to source profile files.
      --debug           Print the decoded payload string for dry-run debugging.
  -h, --help            Display this help message and exit.

Examples:
  # Start an interactive shell pre-loaded with local function and variable
  ssh -t user@host "$(cosse -f my_func -v LESS -i)"

  # Execute a local function remotely with options and arguments
  ssh -t user@host "$(cosse -s ~/.bash_aliases -f deploy_app -- deploy_app production)"

  # Use aliases for repeated operations
  alias sshenv-base="cosse --source='${HOME}/.bash_aliases' --alias={l,ll,la} --func={l-size,field,total,avg,max,min,max-line,min-line,from-iec,to-iec,showargs}"
  ssh -t user@host "$(sshenv-base -li -- echo 'Home Sweet Home')"

Test

./test/bats/bin/bats test

About

Bring your tools to your SSH session

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages