Skip to content

Commit

Permalink
Merge pull request #3 from krnsk0/1.0.1
Browse files Browse the repository at this point in the history
1.0.1
  • Loading branch information
krnsk0 authored Aug 29, 2020
2 parents 463dc2d + a498214 commit f2ba1c6
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: run tests for three node versions

on:
push:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package
name: publish to npm

on:
release:
Expand Down Expand Up @@ -31,4 +28,3 @@ jobs:
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> Interactive git user switcher
```
____ _ _ ___ ____ ____
/ _ | | | |/___)/ _ )/ ___)
Expand All @@ -6,39 +8,39 @@
(_____|
```

![Coverage lines](./badges/badge-lines.svg)
![Coverage functions](./badges/badge-functions.svg)
![Coverage branches](./badges/badge-branches.svg)
![Coverage statements](./badges/badge-statements.svg)
![Coverage lines](./static/badge-lines.svg)
![Coverage functions](./static/badge-functions.svg)
![Coverage branches](./static/badge-branches.svg)
![Coverage statements](./static/badge-statements.svg)

[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

# What is this?
## What is this?

Do you manage multiple git users on a single machine? Do you often switch between work and personal git accounts and configure different repositories to use differnet accounts? `guser` is an interactive tool inspired by [WindomZ's `gituser.js`](https://github.com/WindomZ/gituser.js) that helps make git user-switching a tiny bit easier by remembering user/email combinations you've used in the past.
Do you manage multiple git users on a single machine? Do you often switch between work and personal git accounts and configure different repositories to use differnet accounts? `guser` is an interactive tool inspired by [WindomZ's `gituser`](https://github.com/WindomZ/gituser.js) that helps make git user-switching a tiny bit easier by remembering user/email combinations you've used in the past.

<img src="./static/screenshot.jpg" width="340">

If you want the [unix philosophy](https://en.wikipedia.org/wiki/Unix_philosophy#:~:text=The%20Unix%20philosophy%20is%20documented,%2C%20as%20yet%20unknown%2C%20program.) version of this tool, go with [`gituser.js`](https://github.com/WindomZ/gituser.js), but if you like interactive input, choose `guser`: while this tool does one thing and does it well, it is not readily scriptable.

# Installation
## Installation

Requires `node` 10.x, 12.x, or 14.x.

```
```bash
npm i -g guser
```

Configuration is saved in a dotfile in your home directory (`~/.guser`).

# Usage
## Usage

You'll of course need a working version of `git` in your path.

To start:

```
```bash
guser
```

Expand Down
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
"bin": "./index.js",
"author": "[email protected]",
"license": "MIT",
"bugs": {
"url": "https://github.com/krnsk0/guser/issues"
},
"homepage": "https://github.com/krnsk0/guser#readme",
"keywords": [
"git",
"cli",
"interactive",
"config",
"user"
],
"repository": {
"type": "git",
"url": "[email protected]:krnsk0/guser.git"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
Expand Down
56 changes: 30 additions & 26 deletions src/topLevelMenu/topLevelMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,42 @@ const ADD = 'add';
const REMOVE = 'remove';
const LIST = 'list';

const makeTopLevelChoices = () => {
return [
{
title: 'Set local git user config',
value: SET,
},
{
title: 'Unset local git user config',
value: UNSET,
},
{
title: 'Show local git user config',
value: SHOW,
},
{
title: 'Add user config to guser',
value: ADD,
},
{
title: 'Remove user config from guser',
value: REMOVE,
},
{
title: 'List configs in guser',
value: LIST,
},
];
};

const topLevelPrompt = () =>
prompts({
type: 'select',
name: 'choice',
message: 'What would you like to do?',
hint: '(use arrow keys & enter to select)',
choices: [
{
title: 'Set local git user config',
value: SET,
},
{
title: 'Unset local git user config',
value: UNSET,
},
{
title: 'Show local git user config',
value: SHOW,
},
{
title: 'Add user config to guser',
value: ADD,
},
{
title: 'Remove user config from guser',
value: REMOVE,
},
{
title: 'List configs in guser',
value: LIST,
},
],
choices: makeTopLevelChoices(),
});

const choiceHandlers = {
Expand Down

0 comments on commit f2ba1c6

Please sign in to comment.