Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
81e05cf859
|
|||
64897d32e4
|
|||
0408fe856d
|
|||
4e3b711567
|
|||
7f0bff57eb
|
|||
92f167e7e8
|
|||
c7ebd6350e
|
|||
d7d55d24f5
|
|||
6381c189cb
|
|||
d0568e48ec
|
|||
f66a6c858d
|
|||
267d546d2e
|
|||
87c9c36f6c
|
|||
2f19707e94
|
|||
a79d0ee6d4
|
|||
32ad2b3fd7
|
|||
0a3a4d4f74
|
|||
95f3254f81
|
|||
5894bd5bb1
|
|||
560f8f4fd0
|
|||
e1d8e27c23
|
|||
2e19df72b0
|
|||
08b3e1cf5b
|
|||
d592b5f2d8
|
|||
3f06afce02
|
|||
d553bf06b7
|
|||
7427f8f8d8
|
|||
e350d8c13d
|
|||
27f5287c82
|
|||
cf7ce40afd
|
|||
8149da56fb
|
|||
af591b9802
|
|||
300d16d630
|
|||
09f6ad35f9
|
|||
64f853d025
|
|||
07a2143d50
|
|||
0ca6347f1f
|
|||
9fc27f2c0e
|
|||
98cb397ea9
|
5
.drone.yml
Normal file
5
.drone.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
kind: template
|
||||||
|
load: bust_rustbin_default_template.yaml
|
||||||
|
name: toolkit
|
||||||
|
data:
|
||||||
|
binName: toolkit
|
89
.github/workflows/release-published.yml
vendored
Normal file
89
.github/workflows/release-published.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
name: release-published
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
brew-releaser:
|
||||||
|
name: Homebrew releaser
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Release to homebrew tap
|
||||||
|
uses: Justintime50/homebrew-releaser@v1
|
||||||
|
with:
|
||||||
|
# The name of the homebrew tap to publish your formula to as it appears on GitHub.
|
||||||
|
# Required - strings.
|
||||||
|
homebrew_owner: kjuulh
|
||||||
|
homebrew_tap: homebrew-brew
|
||||||
|
|
||||||
|
# The name of the folder in your homebrew tap where formula will be committed to.
|
||||||
|
# Default is shown - string.
|
||||||
|
formula_folder: formula
|
||||||
|
|
||||||
|
# The GitHub Token (saved as a repo secret) that has `repo` permissions for the homebrew tap you want to release to.
|
||||||
|
# Required - string.
|
||||||
|
github_token: ${{ secrets.BREW_GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Git author info used to commit to the homebrew tap.
|
||||||
|
# Defaults are shown - strings.
|
||||||
|
commit_owner: kjuulh
|
||||||
|
commit_email: homebrew-releaser@kjuulh.io
|
||||||
|
|
||||||
|
# Custom dependencies in case other formulas are needed to build the current one.
|
||||||
|
# Optional - multiline string.
|
||||||
|
depends_on: |
|
||||||
|
"fzf"
|
||||||
|
"gh"
|
||||||
|
"dust"
|
||||||
|
"bottom"
|
||||||
|
"procs"
|
||||||
|
"sourcegraph/src-cli/src-cli"
|
||||||
|
"tokei"
|
||||||
|
"bandwhich"
|
||||||
|
|
||||||
|
# Custom install command for your formula.
|
||||||
|
# Required - string.
|
||||||
|
install: 'bin.install "toolkit"'
|
||||||
|
|
||||||
|
# Custom test command for your formula so you can run `brew test`.
|
||||||
|
# Optional - string.
|
||||||
|
#test: 'assert_match("my script output", shell_output("my-script-command"))'
|
||||||
|
|
||||||
|
# Adds URL and checksum targets for different OS and architecture pairs. Using this option assumes
|
||||||
|
# a tar archive exists on your GitHub repo with the following URL pattern (this cannot be customized):
|
||||||
|
# https://github.com/{GITHUB_OWNER}/{REPO_NAME}/releases/download/{TAG}/{REPO_NAME}-{VERSION}-{OPERATING_SYSTEM}-{ARCHITECTURE}.tar.gz'
|
||||||
|
# Darwin AMD pre-existing path example: https://github.com/justintime50/myrepo/releases/download/v1.2.0/myrepo-1.2.0-darwin-amd64.tar.gz
|
||||||
|
# Linux ARM pre-existing path example: https://github.com/justintime50/myrepo/releases/download/v1.2.0/myrepo-1.2.0-linux-arm64.tar.gz
|
||||||
|
# Optional - booleans.
|
||||||
|
target_darwin_amd64: true
|
||||||
|
target_darwin_arm64: true
|
||||||
|
target_linux_amd64: true
|
||||||
|
target_linux_arm64: true
|
||||||
|
|
||||||
|
# Update your homebrew tap's README with a table of all projects in the tap.
|
||||||
|
# This is done by pulling the information from all your formula.rb files - eg:
|
||||||
|
#
|
||||||
|
# | Project | Description | Install |
|
||||||
|
# | ------------------------------------------ | ------------ | ------------------------ |
|
||||||
|
# | [formula_1](https://github.com/user/repo1) | helpful text | `brew install formula_1` |
|
||||||
|
# | [formula_2](https://github.com/user/repo2) | helpful text | `brew install formula_2` |
|
||||||
|
# | [formula_3](https://github.com/user/repo3) | helpful text | `brew install formula_3` |
|
||||||
|
#
|
||||||
|
# Simply place the following in your README or wrap your project in these comment tags:
|
||||||
|
# <!-- project_table_start -->
|
||||||
|
# TABLE HERE
|
||||||
|
# <!--project_table_end -->
|
||||||
|
#
|
||||||
|
# Finally, mark `update_readme_table` as `true` in your GitHub Action config and we'll do the work of building a custom table for you.
|
||||||
|
# Default is `false` - boolean.
|
||||||
|
update_readme_table: true
|
||||||
|
|
||||||
|
# Skips committing the generated formula to a homebrew tap (useful for local testing).
|
||||||
|
# Default is shown - boolean.
|
||||||
|
skip_commit: false
|
||||||
|
|
||||||
|
# Logs debugging info to console.
|
||||||
|
# Default is shown - boolean.
|
||||||
|
debug: true
|
114
.github/workflows/release.yml
vendored
Normal file
114
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
name: release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- next
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: ${{ matrix.target }}
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
release-target: linux-amd64
|
||||||
|
deb: true
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: arm-unknown-linux-musleabihf
|
||||||
|
release-target: linux-arm
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: armv7-unknown-linux-musleabihf
|
||||||
|
release-target: linux-arm7
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: aarch64-unknown-linux-musl
|
||||||
|
release-target: linux-arm64
|
||||||
|
deb: true
|
||||||
|
|
||||||
|
- os: macos-11
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
release-target: darwin-amd64
|
||||||
|
- os: macos-11
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
release-target: darwin-arm64
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get version
|
||||||
|
id: get_version
|
||||||
|
run: sed -En 's/^version = "(.*)"/value=\1/p' Cargo.toml >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Setup cache
|
||||||
|
uses: Swatinem/rust-cache@v1
|
||||||
|
with:
|
||||||
|
key: ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Build binary
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --release --locked --target=${{ matrix.target }} --color=always --verbose
|
||||||
|
use-cross: ${{ runner.os == 'Linux' }}
|
||||||
|
|
||||||
|
- name: Install cargo-deb
|
||||||
|
if: ${{ matrix.deb == true }}
|
||||||
|
uses: actions-rs/install@v0.1
|
||||||
|
with:
|
||||||
|
crate: cargo-deb
|
||||||
|
|
||||||
|
- name: Build deb
|
||||||
|
if: ${{ matrix.deb == true }}
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: deb
|
||||||
|
args: --no-build --no-strip --output=. --target=${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Package (*nix)
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: >
|
||||||
|
tar -cv
|
||||||
|
LICENSE README.md
|
||||||
|
man/
|
||||||
|
-C target/${{ matrix.target }}/release/ toolkit
|
||||||
|
| gzip --best
|
||||||
|
> 'toolkit-${{ steps.get_version.outputs.value }}-${{ matrix.release-target }}.tar.gz'
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.release-target }}
|
||||||
|
path: |
|
||||||
|
*.deb
|
||||||
|
*.tar.gz
|
||||||
|
*.zip
|
||||||
|
- name: Create release
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'chore(release)') }}
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
files: |
|
||||||
|
*.deb
|
||||||
|
*.tar.gz
|
||||||
|
*.zip
|
||||||
|
name: v${{ steps.get_version.outputs.value }}
|
||||||
|
tag_name: v${{ steps.get_version.outputs.value }}
|
26
Cargo.lock
generated
26
Cargo.lock
generated
@@ -178,18 +178,18 @@ checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.47"
|
version = "1.0.49"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
|
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.21"
|
version = "1.0.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@@ -265,9 +265,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.105"
|
version = "1.0.107"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
|
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -285,18 +285,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.37"
|
version = "1.0.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
|
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.37"
|
version = "1.0.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
|
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -316,7 +316,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toolkit"
|
name = "toolkit"
|
||||||
version = "0.1.0"
|
version = "0.1.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"eyre",
|
"eyre",
|
||||||
@@ -329,9 +329,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "util"
|
name = "util"
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "toolkit"
|
name = "toolkit"
|
||||||
version = "0.1.0"
|
description = "Toolkit is an opinionated toolkit complementing a personal development workflow. Many of the commands are quite verbose, and well suited for adding to your shell toolbelt"
|
||||||
|
version = "0.1.10"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license-file = "LICENSE"
|
||||||
|
authors = ["Kasper J. Hermansen contact@kjuulh.io"]
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
|
61
README.md
Normal file
61
README.md
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# Toolkit
|
||||||
|
|
||||||
|
This is an opinionated toolkit, which reflect my (@kjuulh) way of working. This
|
||||||
|
project aims to enhance a general workflow, and provides tools that may be
|
||||||
|
useful outside of project work. For project work see repo:kjuulh/bust or
|
||||||
|
repo:kjuulh/char, which aims for the same thing, but for projects themselves.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Currenly I only publish homebrew packages, however, all artifacts are released
|
||||||
|
via. released, that includes deb packages as well.
|
||||||
|
|
||||||
|
### Homebrew
|
||||||
|
|
||||||
|
```
|
||||||
|
brew install kjuulh/brew/toolkit
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
To use toolkit you will need a series of environment variables, they are only
|
||||||
|
needed if you need the associated tool.
|
||||||
|
|
||||||
|
```
|
||||||
|
export SRC_ENDPOINT=https://sourcegraph.com
|
||||||
|
export SRC_ACCESS_TOKEN=
|
||||||
|
export GITHUB_FC_ROOT="/Users/<username>/git/github.com"
|
||||||
|
export GITHUB_FC_ORGS="kjuulh"
|
||||||
|
```
|
||||||
|
|
||||||
|
`SRC` is sourcegraph integration. The endpoint is either to the public instance,
|
||||||
|
or your own domain. The access token is a personal access token. If either of
|
||||||
|
these are missing. A prompt will be shown on the first run
|
||||||
|
|
||||||
|
`GITHUB_FC` is the fuzzy clone setup. First is the destination path, this is
|
||||||
|
where the orgs will be placed. Second is ORGS, that is which orgs to subscribe
|
||||||
|
to. The total path in this case will end up being
|
||||||
|
`/Users/<username>/git/github.com/kjuulh`.
|
||||||
|
|
||||||
|
You will also require other integration such as a GitHub integration through
|
||||||
|
`gh`.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
Usage: toolkit <COMMAND>
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
prereqs
|
||||||
|
tldr
|
||||||
|
sourcegraph
|
||||||
|
github
|
||||||
|
stats
|
||||||
|
init
|
||||||
|
help Print this message or the help of the given subcommand(s)
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Print help information
|
||||||
|
```
|
||||||
|
|
||||||
|

|
BIN
assets/demo.gif
Normal file
BIN
assets/demo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 MiB |
@@ -1,5 +1,6 @@
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
|
use clap::value_parser;
|
||||||
use eyre::Context;
|
use eyre::Context;
|
||||||
|
|
||||||
pub struct FuzzyClone;
|
pub struct FuzzyClone;
|
||||||
@@ -201,13 +202,18 @@ impl FuzzyClone {
|
|||||||
}),
|
}),
|
||||||
)?;
|
)?;
|
||||||
} else {
|
} else {
|
||||||
util::shell::run(&["git", "pull"], None)?;
|
let _ = util::shell::run(
|
||||||
|
&["git", "pull"],
|
||||||
|
Some(util::shell::RunOptions {
|
||||||
|
path: git_repo_path.clone(),
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(git_repo_path)
|
Ok(git_repo_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run() -> eyre::Result<()> {
|
fn run(print_dest: &bool) -> eyre::Result<()> {
|
||||||
let settings = Self::get_settings()?;
|
let settings = Self::get_settings()?;
|
||||||
if settings.auto_update {
|
if settings.auto_update {
|
||||||
println!("running auto update");
|
println!("running auto update");
|
||||||
@@ -234,10 +240,17 @@ impl FuzzyClone {
|
|||||||
let chosen = util::shell::run_with_input_and_output(&["fzf"], entries_str)?;
|
let chosen = util::shell::run_with_input_and_output(&["fzf"], entries_str)?;
|
||||||
let chosen = std::str::from_utf8(&chosen.stdout)?;
|
let chosen = std::str::from_utf8(&chosen.stdout)?;
|
||||||
|
|
||||||
Self::clone(GitHubEntry::from(chosen.to_string()).ok_or(eyre::anyhow!(
|
let path = Self::clone(GitHubEntry::from(chosen.to_string()).ok_or(eyre::anyhow!(
|
||||||
"could not parse choice as github entry <org>/<repo>"
|
"could not parse choice as github entry <org>/<repo>"
|
||||||
))?)?;
|
))?)?;
|
||||||
|
|
||||||
|
if *print_dest {
|
||||||
|
print!(
|
||||||
|
"{}",
|
||||||
|
path.to_str().ok_or(eyre::anyhow!("path was not found"))?
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,13 +268,24 @@ impl util::Cmd for FuzzyClone {
|
|||||||
Ok(clap::Command::new("fuzzy-clone")
|
Ok(clap::Command::new("fuzzy-clone")
|
||||||
.alias("fc")
|
.alias("fc")
|
||||||
.alias("c")
|
.alias("c")
|
||||||
|
.arg(
|
||||||
|
clap::Arg::new("print-dest")
|
||||||
|
.long("print-dest")
|
||||||
|
.value_name("print-dest")
|
||||||
|
.value_parser(value_parser!(bool))
|
||||||
|
.num_args(0..=1)
|
||||||
|
.require_equals(true)
|
||||||
|
.default_missing_value("true"),
|
||||||
|
)
|
||||||
.subcommand(clap::Command::new("update")))
|
.subcommand(clap::Command::new("update")))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
|
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
|
||||||
|
let print_dest = args.get_one::<bool>("print-dest").unwrap_or(&false);
|
||||||
|
|
||||||
match args.subcommand() {
|
match args.subcommand() {
|
||||||
Some(("update", _)) => Self::update()?,
|
Some(("update", _)) => Self::update()?,
|
||||||
_ => Self::run()?,
|
_ => Self::run(print_dest)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
use std::{borrow::Borrow, ffi::OsString};
|
|
||||||
|
|
||||||
pub struct Search;
|
pub struct Search;
|
||||||
|
|
||||||
impl util::Cmd for Search {
|
impl util::Cmd for Search {
|
||||||
@@ -12,8 +10,8 @@ impl util::Cmd for Search {
|
|||||||
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
|
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
|
||||||
match args.subcommand() {
|
match args.subcommand() {
|
||||||
Some((external, args)) => {
|
Some((external, args)) => {
|
||||||
let mut raw = args
|
let raw = args
|
||||||
.get_many::<OsString>("")
|
.get_many::<std::ffi::OsString>("")
|
||||||
.ok_or(eyre::anyhow!("please pass some args to search"))?
|
.ok_or(eyre::anyhow!("please pass some args to search"))?
|
||||||
.map(|s| s.as_os_str())
|
.map(|s| s.as_os_str())
|
||||||
.map(|s| s.to_string_lossy().to_string())
|
.map(|s| s.to_string_lossy().to_string())
|
||||||
|
@@ -2,13 +2,13 @@ pub struct Perf;
|
|||||||
|
|
||||||
impl Perf {
|
impl Perf {
|
||||||
fn run() -> eyre::Result<()> {
|
fn run() -> eyre::Result<()> {
|
||||||
if let Err(_) = util::shell::run_with_input_and_output(&["ytop", "--version"], "".into()) {
|
if let Err(_) = util::shell::run_with_input_and_output(&["btm", "--version"], "".into()) {
|
||||||
return Err(eyre::anyhow!(
|
return Err(eyre::anyhow!(
|
||||||
"could not find ytop, please install or add to PATH"
|
"could not find btm, please install or add to PATH"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
util::shell::run(&["ytop"], None)?;
|
util::shell::run(&["btm"], None)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ impl Procs {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
util::shell::run(&["procs"], None)?;
|
util::shell::run_with_input(&["procs"], "".into())?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,9 @@ impl util::Cmd for Update {
|
|||||||
let mut tldr_cache_dir = cache_dir.clone();
|
let mut tldr_cache_dir = cache_dir.clone();
|
||||||
tldr_cache_dir.push("kah-toolkit/tldr/store/");
|
tldr_cache_dir.push("kah-toolkit/tldr/store/");
|
||||||
|
|
||||||
std::fs::remove_dir_all(&tldr_cache_dir)?;
|
if let Err(_) = std::fs::remove_dir_all(&tldr_cache_dir) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
std::fs::create_dir_all(&tldr_cache_dir)?;
|
std::fs::create_dir_all(&tldr_cache_dir)?;
|
||||||
|
|
||||||
util::shell::run(
|
util::shell::run(
|
||||||
|
0
man/.gitkeep
Normal file
0
man/.gitkeep
Normal file
13
src/init/fish.rs
Normal file
13
src/init/fish.rs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
pub struct Fish;
|
||||||
|
|
||||||
|
impl util::Cmd for Fish {
|
||||||
|
fn cmd() -> eyre::Result<clap::Command> {
|
||||||
|
let cmd = clap::Command::new("fish").subcommands(&[]);
|
||||||
|
|
||||||
|
Ok(cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
20
src/init/mod.rs
Normal file
20
src/init/mod.rs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
mod fish;
|
||||||
|
|
||||||
|
pub struct Init;
|
||||||
|
|
||||||
|
impl util::Cmd for Init {
|
||||||
|
fn cmd() -> eyre::Result<clap::Command> {
|
||||||
|
let cmd = clap::Command::new("init")
|
||||||
|
.subcommands(&[fish::Fish::cmd()?])
|
||||||
|
.subcommand_required(true);
|
||||||
|
|
||||||
|
Ok(cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
|
||||||
|
match args.subcommand() {
|
||||||
|
Some(("fish", args)) => fish::Fish::exec(args),
|
||||||
|
_ => Err(eyre::anyhow!("missing command!")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
use util::Cmd;
|
use util::Cmd;
|
||||||
|
|
||||||
|
mod init;
|
||||||
mod prereqs;
|
mod prereqs;
|
||||||
|
|
||||||
fn main() -> eyre::Result<()> {
|
fn main() -> eyre::Result<()> {
|
||||||
@@ -10,7 +11,9 @@ fn main() -> eyre::Result<()> {
|
|||||||
sourcegraph::Sourcegraph::cmd()?,
|
sourcegraph::Sourcegraph::cmd()?,
|
||||||
github::GitHub::cmd()?,
|
github::GitHub::cmd()?,
|
||||||
stats::Stats::cmd()?,
|
stats::Stats::cmd()?,
|
||||||
|
init::Init::cmd()?,
|
||||||
])
|
])
|
||||||
|
.subcommand_required(true)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
@@ -19,6 +22,7 @@ fn main() -> eyre::Result<()> {
|
|||||||
Some(("sourcegraph", subcmd)) => sourcegraph::Sourcegraph::exec(subcmd),
|
Some(("sourcegraph", subcmd)) => sourcegraph::Sourcegraph::exec(subcmd),
|
||||||
Some(("github", subcmd)) => github::GitHub::exec(subcmd),
|
Some(("github", subcmd)) => github::GitHub::exec(subcmd),
|
||||||
Some(("stats", subcmd)) => stats::Stats::exec(subcmd),
|
Some(("stats", subcmd)) => stats::Stats::exec(subcmd),
|
||||||
|
Some(("init", subcmd)) => init::Init::exec(subcmd),
|
||||||
_ => Err(eyre::anyhow!("no command selected!")),
|
_ => Err(eyre::anyhow!("no command selected!")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user