Skip to content

KennethanCeyer/gowap

Repository files navigation

Github Release

Build Status Test Coverage Coverage Status

Go Report Card codebeat badge Maintainability

⚠️ Notice

This project is working in progress project

If you follow the below installation guide, you may not get the intended result

But you can express your interest by clicking star on this project.

The more star in this repository, the more nervous the maintainer will be and will focus more on this project than any other project.

👏for those who are suffering from managing multiple ssh keys

the goal of this project is quite simple

  • ssh-key changes must be simple and quick
  • you can set an alias name for each of the ssh keys
  • it could be nice, if this cli can support to register your ssh-key to github by using api

📐 Blueprint

rules

  • it must follows cleancode rule
  • proceed with TDD-based development
  • minimize dependence
  • support all popular os

usage

  1. generate ssh key for test
$ ssh-keygen
  1. add ~/.ssh/id_rsa ~/.ssh/id_rsa as home
$ gowap add home
enter file in which to add the private key (~/.ssh/id_rsa):
enter file in which to add the public key (~/.ssh/id_rsa.pub):
...
your ssh key is added as `home`
  1. hiding current ssh key for generate new ssh key
$ gowap archive
ssh key is archived *home -> archive
  1. generate new ssh key
$ ssh-keygen
  1. add ~/.ssh/id_rsa ~/.ssh/id_rsa as company
$ gowap add company
enter file in which to add the private key (~/.ssh/id_rsa):
enter file in which to add the public key (~/.ssh/id_rsa.pub):
...
your ssh key is added as 'company'
  1. list all keys
$ gowap list
* company
home
  1. situation: you clone your company's private repository with company ssh-key
$ git clone git@github.com:nickname/some-awesome-project.git
  1. you can edit and push because company ssh key has a permission for that
$ touch some-changes
$ git add some-changes
$ git commit -m "add some-changes"
$ git push origin master
  1. but you need to update your personal repository
$ git clone git@github.com:personal-nickname/personal-project.git
  1. you can't clone this repository bacause company ssh key hasn't any permissions for access
Permission denied (publickey).
  1. you can checkout your personal ssh key home
$ gowap checkout home
your now key is 'home'
  1. you can clone now
$ git clone git@github.com:personal-nickname/personal-project.git

features

add

add without nuts name

this case, default nuts name set to home

gowap add 
# output
? enter file in which to add the private key /Users/user/.ssh/id_rsa
? enter file in which to add the public key /Users/user/.ssh/id_rsa.pub
? `home` is already defined, Do you want to overwrite it? Yes
INFO[0000] try to overwrite to `home`                    overwrite=true
INFO[0000] new nuts has been added                       nuts=home

add with nuts name

gowap add {:name}
# output
? enter file in which to add the private key /Users/user/.ssh/id_rsa
? enter file in which to add the public key /Users/user/.ssh/id_rsa.pub
INFO[0000] new nuts has been added                       nuts={:name}

add with git config

gowap add --with git
# output
? enter file in which to add the private key /Users/user/.ssh/id_rsa
? enter file in which to add the public key /Users/user/.ssh/id_rsa.pub
INFO[0000] with git configuration                        git={"user": "xxx", "mail": "xxx", "autoSign": true, "signKey": "xxx"}
INFO[0000] new nuts has been added                       nuts={:name}

remove

remove without nuts name

this case, default nuts name set to home

gowap remove
# output:
? are you sure? Yes
INFO[0000] `home` nuts has been removed                 nuts=home

remove with nuts name

gowap remove {:name}
# output:
? are you sure? Yes
INFO[0000] `{:name}` nuts has been removed              nuts={:name}

list

show list of nuts

gowap list
# output
* home
company
temporary
user2

search list with keyword

keyword will include follows:

  • git config values
  • alias name
  • nuts name
gowap list --keyword {:keyword}
# output
company | git user.name "kenneth ceyer"
temporary | alias name "kenneth"

version

show current gowap version

gowap version
# output
gowap version 0.0.1

📦 Installation

💛 go

$ go get github.com/KennethanCeyer/gowap
$ gowap -v
NAME:
   gowap - simple ssh swap tool

USAGE:
   gowap.exe [global options] command [command options] [arguments...]

VERSION:
   x.x.x

AUTHOR:
   kenneth ceyer <https://github.com/KennethanCeyer>

COMMANDS:
     add a        add ssh profile
     remove, r .  remove ssh profile
     list, l      show list ssh profiles
     archive h    archive ssh profile
     help, h      show a list of commands or help for one command
     version, v   show current gowap version
     ...

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version
   ...

💔 linux (still yet not supported)

$ apt-get install gowap

💔 Mac (still yet not supported)

$ brew install gowap

💔 Windows (still yet not supported)

$ choco install gowap

🔍 License

gowap is under Apache 2.0 license

you can, of course. download it, use it, modify it

FOSSA Status