Comparing version 0.3.0 to 0.3.1
@@ -468,16 +468,11 @@ "use strict"; | ||
} | ||
function readRawGitBranches(gitRepoFolder) { | ||
function collectBranchNames(folderPath, prefix = '') { | ||
return fs_1.readdirSync(folderPath, { withFileTypes: true }) | ||
.reduce((branches, item) => { | ||
if (item.isFile()) { | ||
branches.push(prefix + item.name); | ||
} | ||
if (item.isDirectory()) { | ||
branches = branches.concat(collectBranchNames(fsPath.join(folderPath, item.name), `${prefix}${item.name}/`)); | ||
} | ||
return branches; | ||
}, []); | ||
function readRawGitBranches() { | ||
const { stdout, stderr, error } = child_process_1.spawnSync('git', ['branch', `--format=%(refname:short)`], { encoding: 'utf-8' }); | ||
if (error) { | ||
throw new Error(`Could not get the list of Git branches. Cause: ${error.message}. Stacktrace: ${error.stack}.`); | ||
} | ||
return collectBranchNames(fsPath.join(gitRepoFolder, '.git/refs/heads')); | ||
if (stderr !== '') { | ||
throw new Error(`Could not get the list of Git branches. Cause: ${stderr}.`); | ||
} | ||
return stdout.split('\n').filter(branchName => branchName !== ''); | ||
} | ||
@@ -512,3 +507,3 @@ const JUMP_FOLDER = '.jump'; | ||
function readBranchesData(gitRepoFolder) { | ||
const rawGitBranches = readRawGitBranches(gitRepoFolder); | ||
const rawGitBranches = readRawGitBranches(); | ||
const branchesJumpData = readBranchesJumpData(gitRepoFolder); | ||
@@ -585,21 +580,2 @@ cleanUpJumpData(gitRepoFolder, branchesJumpData, rawGitBranches); | ||
} | ||
function chainGitCommands(...commands) { | ||
return commands.reduce((results, command) => { | ||
const result = command(); | ||
results.push(result); | ||
return results; | ||
}, []); | ||
} | ||
function compoundGitCommandsResult(results) { | ||
return results.reduce((compoundResult, result, i) => { | ||
compoundResult.status = result.status; | ||
compoundResult.message = compoundResult.message.concat(result.message); | ||
if (i !== results.length - 1) { | ||
compoundResult.message.push(''); | ||
} | ||
compoundResult.stderr += result.stderr; | ||
compoundResult.stdout += result.stdout; | ||
return compoundResult; | ||
}, { status: 0, message: [], stderr: '', stdout: '' }); | ||
} | ||
function gitSwitch(args) { | ||
@@ -606,0 +582,0 @@ const isParameter = (argument) => argument.startsWith('-') || argument.startsWith('--'); |
{ | ||
"name": "git-jump", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Git Branches Helper", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -5,8 +5,11 @@ ![git-jump CLI logo](https://raw.githubusercontent.com/mykolaharmash/git-jump/main/img/readme-banner.png) | ||
All native `git switch ⋯` features, plus: | ||
* Interactive UI to view and switch branches | ||
* Branches are sorted by usage recency | ||
* Sorting by recently used | ||
* Fuzzy search | ||
* Fuzzy switch: `git jump hlw` → `git switch hello-world` | ||
* Uses native `git switch` under the hood, supports all its parameters | ||
See [how it looks](#How-It-Looks-In-Action). | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/mykolaharmash/git-jump/main/img/demo.gif" alt="git jump interactive interface" width="600px" style="border-radius: 5px;" /> | ||
</p> | ||
@@ -83,9 +86,2 @@ ## Install | ||
## How It Looks In Action | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/mykolaharmash/git-jump/main/img/demo.gif" alt="git jump interactive interface" width="600px" style="border-radius: 5px;" /> | ||
</p> | ||
## How To Enable <kbd>Option/Alt</kbd>+<kbd>\<number\></kbd> Shortcut | ||
@@ -113,6 +109,2 @@ | ||
modifierKeys: { altIsMeta: true } | ||
``` | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41610
935
107