From c4767077fcbf0e7f53e2283c8ca55b4579d36d67 Mon Sep 17 00:00:00 2001 From: Wendell Sun Date: Mon, 9 Oct 2017 15:41:43 +0800 Subject: [PATCH] set shorter sub command alias && update README.md file --- README.md | 35 +++++++++++++++++++++++++++++++++-- main.go | 10 +++++----- utils.go | 4 ++-- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a3d91ca..c7b2db1 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,20 @@ [![Build Status](https://travis-ci.org/xwjdsh/manssh.svg?branch=master)](https://travis-ci.org/xwjdsh/manssh) [![Go Report Card](https://goreportcard.com/badge/github.com/xwjdsh/manssh)](https://goreportcard.com/report/github.com/xwjdsh/manssh) +[![codebeat badge](https://codebeat.co/badges/38954713-7443-4149-915d-4543da2a5da5)](https://codebeat.co/projects/github-com-xwjdsh-manssh-master) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + + manssh is a command line tool for manage your ssh alias config easily, inspire by [storm](https://github.com/emre/storm) project, power by Go. +Note: only `Host`, `HostName`, `User`, `Port`, `IdentityFile` and `ProxyCommand` is implemented at this point, **other configs and comments will loss**. + ![](https://raw.githubusercontent.com/xwjdsh/manssh/master/screenshot/manssh.png) ## Install -#### Go +#### Gopher ```shell go get github.com/xwjdsh/manssh ``` @@ -18,6 +23,32 @@ go get github.com/xwjdsh/manssh #### Manual Download it from [releases](https://github.com/xwjdsh/manssh/releases), and extact it to your `PATH` environment. -## Licence +## Usage +```shell +% manssh +NAME: + manssh - Manage your ssh alias configs easily + +USAGE: + manssh [global options] command [command options] [arguments...] +VERSION: + 0.1 + +COMMANDS: + add, a add a new ssh alias record + list, l list all ssh alias records + update, u update existing ssh alias record + delete, d delete existing ssh alias record + backup, b backup ssh alias config records + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + --config value, -c value (default: "/Users/wendell/.ssh/config") + --help, -h show help + --version, -v print the version + +``` + +## Licence [MIT License](https://github.com/xwjdsh/manssh/blob/master/LICENSE) diff --git a/main.go b/main.go index 4fddee7..4cdfcc0 100644 --- a/main.go +++ b/main.go @@ -24,15 +24,15 @@ func flags() []cli.Flag { func commands() []cli.Command { return []cli.Command{ - {Name: "add", Usage: "add a new ssh alias record", Action: add, + {Name: "add", Usage: "add a new ssh alias record", Action: add, Aliases: []string{"a"}, Flags: []cli.Flag{ cli.StringFlag{Name: "file, f"}, cli.StringFlag{Name: "proxy, p"}, }, }, - {Name: "list", Usage: "list all ssh alias records", Action: list}, + {Name: "list", Usage: "list all ssh alias records", Action: list, Aliases: []string{"l"}}, { - Name: "update", Usage: "update existing ssh alias record", Action: update, + Name: "update", Usage: "update existing ssh alias record", Action: update, Aliases: []string{"u"}, Flags: []cli.Flag{ cli.StringFlag{Name: "user, u"}, cli.StringFlag{Name: "host, H"}, @@ -42,7 +42,7 @@ func commands() []cli.Command { cli.StringFlag{Name: "proxy, P"}, }, }, - {Name: "delete", Usage: "delete existing ssh alias record", Action: delete}, - {Name: "backup", Usage: "backup ssh alias config records", Action: backup}, + {Name: "delete", Usage: "delete existing ssh alias record", Action: delete, Aliases: []string{"d"}}, + {Name: "backup", Usage: "backup ssh alias config records", Action: backup, Aliases: []string{"b"}}, } } diff --git a/utils.go b/utils.go index dc52ec8..fb33cf5 100644 --- a/utils.go +++ b/utils.go @@ -15,8 +15,8 @@ import ( ) const ( - version = "0.0.1" - usage = "management ssh config easier" + version = "0.1" + usage = "Manage your ssh alias configs easily" ) var (