-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathowncloud.sh
executable file
·42 lines (33 loc) · 1.19 KB
/
owncloud.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/bash
#
# owncloud -- a simplest owncloud tool for CLI
#
# copyright (c) 2018 Cj-bc
#
# This software is relesed under MIT Lisence.
# http://opensource.org/license/mit-license.php
version=0.3.2
if [ "$1" = "--local" ]
then
OWNCLOUD_PATH="."
shift
source ${OWNCLOUD_PATH}/.sourcefiles
elif [ -e `brew --prefix`/Cellar/owncloud/${version} ]
then
OWNCLOUD_PATH="`brew --prefix`/Cellar/owncloud/${version}"
source ${OWNCLOUD_PATH}/.sourcefiles
[ -e "`brew --prefix`/Cellar/owncloud/config" ] || ownconfig init
fi
# ----- set attribute. if no arg, show help
[ $# -ne 0 ] && attrib="own"$1 || attrib="help"
[ "$attrib" != "help" ] && shift # ---- if first arg was option, shift.
[ -p /dev/stdin ] && pipIn=`/dev/stdin` && attrib=ownpost # ---- if there's pip,read data from it, set to post it
[ -p /dev/stdout ] && pipOut=1 || pipOut=0
case "$attrib" in
"ownshare" | "ownget" | "ownpost" | "ownls" | "ownmv" | "owncp" | "ownmkdir" | "ownrm" | "ownhelp" | "ownconfig")
$attrib $pipIn $@ ;; # pass pipIn(pipIn shuld be the data)
"own-v" | "ownversion" ) echo "owncloud ver:"$version;;
* )
echo "owncloud version: ${version}"
cat ${OWNCLOUD_PATH}/text/API/${API}/usage.txt;;
esac