Skip to content

Commit

Permalink
Merge pull request #10 from mizunashi-mana/fix-some
Browse files Browse the repository at this point in the history
Fix some
  • Loading branch information
whywaita authored Feb 17, 2017
2 parents 0545979 + 0193559 commit e3206da
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 64 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: bash
sudo: required

addons:
apt:
sources:
- debian-sid
packages:
- shellcheck

script:
- shellcheck meshi
- sudo ./install.sh
- export PATH="/opt/local/bin:$PATH"
- meshi

matrix:
fast_finish: true
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# meshi [![Travis Status][travis-image]][travis-url]

## Let's have a lunch!

Bob < Oh... I can't decide where we go...

meshi < Use me!

```bash
$ meshi
shokujin
```

Bob < Whoo! Let's go to shokujin!!!

## Installation

```bash
sudo ./install.sh # or $ PREFIX=/prefix/path ./install.sh
```

[travis-image]: https://travis-ci.org/uecmma/meshi.svg?branch=master
[travis-url]: https://travis-ci.org/uecmma/meshi

20 changes: 20 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -e

if [ -z "$PREFIX" ]; then
PREFIX=''
fi

ASSET_INSTALL_DIR="$PREFIX/etc/meshi"
mkdir -p "$ASSET_INSTALL_DIR"
cp meshi.list "$ASSET_INSTALL_DIR"

COMMAND_INSTALL_DIR="$PREFIX/opt/local/bin"
mkdir -p "$COMMAND_INSTALL_DIR"
cp meshi "$COMMAND_INSTALL_DIR/meshi"
case "$(uname -s)" in
Darwin ) sed -i '' -e "s|/etc/|$PREFIX/etc/|g" "$COMMAND_INSTALL_DIR/meshi" ;;
* ) sed -ie "s|/etc/|$PREFIX/etc/|g" "$COMMAND_INSTALL_DIR/meshi" ;;
esac

104 changes: 40 additions & 64 deletions meshi
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,67 +1,43 @@
#!/bin/sh
#!/bin/bash

set -eo pipefail
[ -n "$MESHI_DEBUG" ] && set -x

case "$(uname -s)" in
Darwin ) SHUF_COMMAND='gshuf' ;;
* ) SHUF_COMMAND='shuf' ;;
esac

if ! type "$SHUF_COMMAND" > /dev/null 2>&1; then
echo "'$SHUF_COMMAND' command not found" >&2
exit 1
fi


function usage() {
cat <<EOS
Usage: meshi [option] [name]
--help : Show this help
-l/--list : Use custom meshi list (default: /etc/meshi/meshi.list)
EOS
[ -z "$1" ] || exit "$1"
}

if [[ "$1" == '--help' ]]; then
usage 0
fi

MESHI_LIST_PATH="/etc/meshi/meshi.list"
if [[ "$1" == '-l' ]] || [[ "$1" == '--list' ]]; then
MESHI_LIST_PATH="$2"
shift 2
fi


if [ "$1" != '' ]; then
echo $1
echo "$1"
else
echo "shokujin
shokujin
shokujin
ootoya
soramame
lunchtime
gakushoku
harumonia
nisishoku
jiro-yaen
jiro-fuchu
jiro-sengawa
chofu-DJ
saburou
mac
tenya
sutadon
matsuya
sennen
saize
koizushi
bigboy
gasuto
jonasan
shokujin
karendo
raja
coco1
C&C
misdo
sukekaku
tonsuke
guracche
takeya
tatsumi
matsuri
DJ
cowboyfamily
kurazushi
chatnoir
starbucks
boteju
tonchinkan
dandadan
honorurushokudo
egao
kenta
wakamatsuya
sakananomanma
ohara
shirataka
hidakaya
nakau
yoshinoya
gyukaku
takechan
gyushige
chofudojo
saburou
saburou
shabuyou
shokujin" | shuf | head -1
"$SHUF_COMMAND" "$MESHI_LIST_PATH" | head -1
fi

49 changes: 49 additions & 0 deletions meshi.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
shokujin
shokujin
shokujin
ootoya
soramame
lunchtime
gakushoku
harumonia
nisishoku
jiro-yaen
jiro-fuchu
jiro-sengawa
chofu-DJ
saburou
mac
tenya
sutadon
matsuya
sennen
saize
koizushi
bigboy
gasuto
jonasan
shokujin
karendo
raja
coco1
C&C
misdo
sukekaku
tonsuke
guracche
takeya
tatsumi
matsuri
DJ
cowboyfamily
kurazushi
chatnoir
starbucks
boteju
tonchinkan
dandadan
honorurushokudo
egao
kenta
wakamatsuya
sakananomanma

0 comments on commit e3206da

Please sign in to comment.