LoginSignup
0
0

More than 1 year has passed since last update.

シンプルなスクリプトパッケージマネージャーを作ってみた

Last updated at Posted at 2021-07-08

原文はこちら
awesome.gif
最近Awesome Package Managerというものを作ったのでその紹介です。他の人にも使ってもらえたらなーと思っています。

ほぼ全てのProgramming LanguageにはPackage ManagerがありますがScript Language用のが見当たらないので作ってみました。

UNIX-LIKEのOSで動きます。(MacOSとUbuntuだけで確認しただけですが他で動く様であればご連絡を。)

Installation

まずはInstallationから

curl -s https://raw.githubusercontent.com/shinokada/awesome/main/install | bash -s install

wgetでもいけるはず

wget -qO - https://raw.githubusercontent.com/shinokada/awesome/main/install | bash -s install

PATHをterminal config ファイルへ (.zshrcとか.bashrc)

export PATH=$HOME/bin:$PATH

もしくはこれをターミナルで叩いてください。(.zshrcは必要に応じて変えてね)

echo 'export PATH=$HOME/bin:$PATH' >> ~/.zshrc

config fileをsourceしましょう。

source ~/.zshrc

Uninstallしたいときは

curl -s https://raw.githubusercontent.com/shinokada/awesome/main/install > tmp1 && bash tmp1 uninstall && rm tmp1

wgetなら

wget -qO - https://raw.githubusercontent.com/shinokada/awesome/main/install > tmp1 && bash tmp1 uninstall && rm tmp1

Installing a package

さて早速パッケージをインストールしてみましょう。

Repoの名前とmain scriptの名前が同じ時

Repoの名前とmain scriptの名前が同じ時はusername/repo-nameでインストールできます。

awesome install shinokada/manop

manopはこちらを参照してください。

URLもしくはHTTPSでもインストールできます。

awesome install https://github.com/shinokada/manop
# or
awesome install https://github.com/shinokada/manop.git

Repoの名前とmain scriptの名前が違う時

Repoの名前とmain scriptの名前が違う時はusername/repo-name main-scriptでインストール。

awesome install raylee/tldr-sh-client tldr

Sub folderがある時

Bash-Snippetsには色々ScriptsがありますがSub folderに分かれてます。

その時はusername/repo-name folder/main-scriptでインストールできます。

awesome install alexanderepstein/Bash-Snippets cheat/cheat
awesome install alexanderepstein/Bash-Snippets weather/weather

パッケージの消去

パッケージを取り除きたいときはrm コマンドで。

awesome rm manop

パッケージのリスト

パッケージのリストを見たいときはlsコマンドで。

awesome ls

パッケージをアップデート

パッケージをアップデートしたい時はupdateコマンドで。

awesome update tldr

開発中にGit pushを

スクリプトを開発中にRepoにPushしたい時はこれ。これはupdateもするのでlocalのscriptも同時にupdateしてくれます。(便利)

awesome push "message"

script languages

Script languages には色々ありましてnode, perl, php, python, rubyなどもっとあります。
PHP scriptをinstallしてみましょう。

awesome install shinokada/script-examples php-example.php

php-example.phpをrunして。

php-example.php
Hello world from PHP!%

shinokada/script-examplesには他のScriptsがあるのでaliasを使かって見ましょう。

aawesome alias ne script-examples node-example.js

neが使えます。

ne
Hello World! from Node.

Other commands

-h | --help
-v | --version
url

"どんなscriptが使えるの?"という質問に。

もっとあるのでこのリストを見てね。
他に使えるものがあればPull request願います。

Name Installation Description
tldr awesome -i raylee/tldr-sh-client tldr a collection of community-maintained help pages for command-line tools
has awesome -i kdabir/has Helps you to check the presence of various command line tools and their versions on a path.
ddgr awesome -i jarun/ddgr DuckDuckGo from the terminal.
desk awesome -i jamesob/desk Lightweight workspace manager for the shell.
gitstart awesome -i shinokada/gitstart GitHub repository automation.
gitig awesome -i shinokada/gitig Fix a gitignore problem.
googler awesome -i jarun/googler Google Search, Google Site Search, Google News from the terminal.
hhighlighter awesome -i paoloantinori/hhighlighter h Colorize words in a command output.
backpack_install awesome -i shinokada/backpack_install Backpack for Laravel installer.
hr awesome -i LuRsT/hr A horizontal ruler for your terminal.
manop awesome -i shinokada/manop Man page description and option viewer.
shml awesome -i odb/shml shml.sh A shell framework for faster and easier script development.
slugify awesome -i benlinton/slugify A bash command that converts filenames and directories to a web friendly format.
spark awesome -i holman/spark ▁▂▃▅▂▇ in your shell.
spot awesome -i rauchg/spot Tiny file search utility.
v awesome -i rupa/v z for vim.
ansiweather awesome -i fcambus/ansiweather Display the current weather conditions.

Repo

GitHub Repoです。

ぜひ使ってみてください。Feedback願います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0