Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installing grive on macOS through homebrew #364

Open
wants to merge 124 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
32f62c0
fix: missing include under OpenBSD
sizeofvoid Oct 9, 2016
150a817
fix: man(1) install directory unter OpenBSD
sizeofvoid Oct 9, 2016
f8ea376
Fix man page to reflect fix #58
aschei Dec 6, 2016
bddf8cf
Add completion file for zsh.
doronbehar Feb 19, 2017
974733f
also compile with cURL Version less than 7.32.0
Mar 10, 2017
e8a8801
Merge pull request #137 from JanST123/old_curl
vitalif Mar 19, 2017
a0aff5b
Fix #136 - Skip links, sockets, fifos and etc
vitalif Mar 19, 2017
63bb138
Fix #120, fix #125, fix #134 - Add .griveignore
vitalif Mar 19, 2017
4b6cf69
Fix #139
vitalif Mar 22, 2017
d996989
Add user systemd units
jankatins Apr 24, 2017
4fe1e71
Issue #148 - add debug message for the case
vitalif Jun 5, 2017
90c603d
added 3 more dependencies
mitoskalandiel Aug 11, 2017
3c90425
Merge pull request #155 from mitoskalandiel/patch-1
vitalif Oct 4, 2017
31b5ab5
Adding command-line options to specify authentication id and secret.
redmercury Oct 14, 2017
81a7c34
Added libstdc++-7-dev in the Build-Depends for Ubuntu 17.10
vlachoudis Nov 7, 2017
5561c0e
Merge pull request #132 from doronbehar/master
vitalif Nov 21, 2017
4e5c61b
Add pkg-config (fixes #126)
vitalif Nov 21, 2017
d84e0d9
Merge pull request #143 from janschulz/systemd_grive
vitalif Nov 21, 2017
262edd7
Merge branch 'master' into master
vitalif Nov 21, 2017
dcbdbfc
Merge branch 'master' into master
vitalif Nov 21, 2017
76d7600
Merge pull request #122 from aschei/master
vitalif Nov 21, 2017
2155b75
Merge pull request #170 from vlachoudis/master
vitalif Nov 21, 2017
84c57c1
Merge pull request #115 from sizeofvoid/master
vitalif Nov 21, 2017
70c5c64
Fix for service files and script to work with directories with spaces…
psfloyd Dec 1, 2017
94bda77
Removed debug line
psfloyd Dec 4, 2017
d698d59
Can enable services systemd excaped
psfloyd Dec 8, 2017
2e75fc6
Fix uninitialized use of c2 variable in State::FromLocal
Jan 3, 2018
8f2f217
Link against specific Boost libraries, avoid using Boost_LIBRARIES
Jan 3, 2018
bff4622
FreeBSD fixes and improvements
Jan 15, 2018
b06f66c
Unbreak the build against new Clang version 6.0.0
Jan 15, 2018
cdea48e
gitignore: ignore files produced by the deb build
jankatins Apr 20, 2017
2de114b
Add systemd file install to README
jankatins Feb 2, 2018
80bbe5f
Adding dockerfiles for isolated build.
TopherGopher Apr 8, 2018
fddabe7
Upping maxResults limits.
TopherGopher Apr 8, 2018
48bfe66
Dockerfile will attempt to build the binary now.
TopherGopher Apr 8, 2018
f5e1b67
Why not just go ahead and run the executable on entry?
TopherGopher Apr 8, 2018
1443dd9
Adding dumb-init.
TopherGopher Apr 8, 2018
f0e3892
Reduces the size of the Docker image.
TopherGopher Apr 8, 2018
f19406e
Reduces the size of the Docker image.
TopherGopher Apr 8, 2018
b47dd70
Exclude symlinks from sync
psfloyd May 13, 2018
5949932
Merge pull request #201 from TopherGopher/master
vitalif Jul 22, 2018
8384f0c
Merge pull request #180 from proski/boost-only-needed-libraries
vitalif Jul 22, 2018
ad9b66a
Merge pull request #186 from cpu82/master
vitalif Jul 22, 2018
6b03e24
Merge pull request #179 from proski/c2-uninitialized
vitalif Jul 22, 2018
6fe5f0c
Merge pull request #177 from psfloyd/master
vitalif Jul 22, 2018
34d4582
Merge pull request #160 from redmercury/custom-id-secret
vitalif Jul 22, 2018
f516356
Merge pull request #196 from jankatins/systemd_files_readme
vitalif Jul 22, 2018
98d5b92
Followup to fddabe760fa739c965e3eaee29bd7673463ae199 - should fix #217
vitalif Jul 28, 2018
93cae25
Fix #169
vitalif Jul 28, 2018
cbac85a
Fix #218 - Impossible to ignore sub-subdirectory via griveignore
vitalif Jul 30, 2018
d4a0445
Added the install instruction for Fedora
Aug 7, 2018
cf51167
Return lost * matching back - fixes #223
vitalif Aug 19, 2018
60ecd5b
Changed the g++ package to gcc-c++
Oct 8, 2018
e3e18fe
Escape folder when calling sync from change listener
jankatins Dec 3, 2018
f9cad3b
Update readme how to enable and start systemd units
jankatins Dec 3, 2018
8e3c3d2
Define off64_t=off_t for macOS
Tatsh Feb 8, 2019
e972a77
Fix line
Tatsh Feb 9, 2019
7ef50e9
libgrive: Fix destructors of Feed and Feed2
Tatsh Feb 9, 2019
6354689
libgrive: fix formatting
Tatsh Feb 9, 2019
d4742fd
Remove unneded link-time dependency on libz and libexpat
jankatins Dec 4, 2018
00d5148
Merge pull request #247 from jankatins/remove-unneded-dependencies
vitalif Feb 24, 2019
294b1b1
Merge pull request #244 from jankatins/fix_unescaped_folder_name
vitalif Feb 24, 2019
f039e38
Merge pull request #221 from martinak1/master
vitalif Feb 24, 2019
fe17d71
Add 'project' directive to the build script
Oct 30, 2019
13ac9bd
Add ACHTUNG note to the README
vitalif Nov 11, 2019
548ea36
Update client_id and client_secret -> maybe Google will verify it?
vitalif Nov 12, 2019
3929909
Move to 0.5.2-dev
vitalif Nov 12, 2019
ad7844b
modified: README.md
Nov 22, 2019
79312b9
Extends support application id and secret support
Dec 13, 2019
bdcb76e
Merge pull request #294 from AmonRaNet/extend-custom-app-id-secret
vitalif Dec 15, 2019
de6404b
Fix Fedora (and RHEL) suggested dependencies
fbicknel Dec 16, 2019
9418297
Add instruction for replacing the OAuth2 client
Dec 31, 2019
37df02a
Merge pull request #297 from AmonRaNet/update-readme
vitalif Jan 6, 2020
a3cce71
Small corrections
vitalif Jan 6, 2020
b4d6ac0
[SymbolInfo.cc] Support compilation with binutils >= 2.33.1 on Debian.
Jan 14, 2020
6aeec25
Adding CMake's Backtrace package to resolve issue where the project f…
redmercury Jan 20, 2020
dc19464
fix ubuntu/debian suggested dependencies
Feb 5, 2020
fa3c394
Merge pull request #303 from lmmamercy/master
vitalif Feb 5, 2020
af2a6de
Merge pull request #299 from cowo78/master
vitalif Feb 5, 2020
58a689a
Merge pull request #295 from fbicknel/patch-1
vitalif Feb 5, 2020
2ddc023
Merge branch 'master' into mac
vitalif Feb 5, 2020
a295641
Merge pull request #259 from Tatsh/mac
vitalif Feb 5, 2020
2ae61ab
Merge branch 'master' into master
vitalif Feb 5, 2020
1456e6e
Merge pull request #289 from danielsouzat/master
vitalif Feb 5, 2020
03bbc20
Merge pull request #300 from redmercury/master
vitalif Feb 5, 2020
ffb744a
Merge pull request #285 from brainplot/cmake-fix
vitalif Feb 5, 2020
7b42e2d
fix systemd-escape hyphen usage
mbartlet Mar 3, 2020
97a9726
Support Debian 10
crborga Apr 8, 2020
a8b8493
Optimized image size (compressed) 214MB -> 62MB
agusalex Sep 23, 2020
c7a949d
Revert "Exclude symlinks from sync"
jankatins Dec 3, 2018
1bab757
Add systemd unit to enable both timer and changes based syncs
jankatins Dec 4, 2018
d7008b8
Remove uneeded binutils-dev depency
jankatins Mar 14, 2021
0b53b08
Increment version for debian package and add some changes there
jankatins Nov 29, 2018
378df28
Do explicit unlocks in grive-sync.sh script
jankatins Mar 15, 2021
4dfc9a5
Install grive-sync.sh into the right libdir
jankatins Mar 15, 2021
5510ca1
More consistent directory name output in logs
jankatins Mar 15, 2021
e0965f7
Remove the libstdc++ dependency
jankatins Mar 16, 2021
27ca714
Add .idea folder to .gitignore
jankatins Mar 18, 2021
9076e3a
Ensure that the systemd files get installed in debian
jankatins Mar 23, 2021
050fcf5
Move helper script into libexec dir
jankatins Mar 30, 2021
814b724
Handle NetBSD like macOS for timestamp precision.
0-wiz-0 Apr 15, 2021
30763e2
Add compatibility define for off64_t.
0-wiz-0 Apr 15, 2021
e36f362
Merge pull request #342 from 0-wiz-0/master
vitalif May 14, 2021
3a28149
Merge pull request #340 from jankatins/update_debian_version
vitalif May 14, 2021
cb3c586
Merge pull request #310 from mbartlet/systemd-escape
vitalif May 14, 2021
b112fcc
Merge pull request #325 from agusalex/master
vitalif May 14, 2021
03a2c58
Fix Dockerfile
agusalex May 14, 2021
d55fe7f
Merge pull request #344 from agusalex/patch-1
vitalif May 14, 2021
dedb762
Merge pull request #246 from jankatins/add-main-systemd-unit
vitalif May 27, 2021
e6fcc63
Merge pull request #245 from jankatins/revert_symlink_handling_in_sync
vitalif May 27, 2021
48f5f0e
fixed: CMAKE_INSTALL_FULL_LIBDIR -> CMAKE_INSTALL_FULL_LIBEXECDIR
ncaq Jul 8, 2021
6901fbb
Merge pull request #345 from ncaq/fix-shell-script-path
vitalif Nov 28, 2021
3cf1c05
Syncer.hh: fix build with gcc-12
junghans May 21, 2022
5c8e87e
Fix CMake CMP0004 Error
jasper1378 Sep 21, 2022
6645206
Implement Google OAuth loopback IP address flow (fixes #362 #372 #365)
vitalif Nov 9, 2022
328987e
Fix readme
vitalif Nov 9, 2022
d03c4a2
Bump version to 0.5.3
vitalif Nov 9, 2022
cd4665a
reduce docker image size even more
jumoog Apr 16, 2022
b788284
Syncer.hh: fix build with gcc-12
junghans May 21, 2022
ae38035
Merge pull request #371 from jasper1378/master
vitalif Dec 10, 2022
f9e9fe5
Merge pull request #363 from junghans/patch-1
vitalif Dec 10, 2022
eb82bfe
Merge pull request #361 from jumoog/master
vitalif Dec 10, 2022
648ff8e
Cache layers during Docker build, take source from the current dir in…
vitalif Dec 10, 2022
be52cb2
Remove libdl build requirement
vitalif Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!cmake
!grive
!libgrive
!CMakeLists.txt
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@ bgrive/bgrive
grive/grive
libgrive/btest
*.cmake

debian/debhelper-build-stamp
debian/files
debian/grive.debhelper.log
debian/grive.substvars
debian/grive/
debian/.debhelper

obj-x86_64-linux-gnu/

.idea
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
cmake_minimum_required(VERSION 2.8)
project(grive2)

include(GNUInstallDirs)

# Grive version. remember to update it for every new release!
set( GRIVE_VERSION "0.5.1-dev" )
set( GRIVE_VERSION "0.5.3" CACHE STRING "Grive version" )
message(WARNING "Version to build: ${GRIVE_VERSION}")

# common compile options
add_definitions( -DVERSION="${GRIVE_VERSION}" )
add_definitions( -D_FILE_OFFSET_BITS=64 -std=c++0x )
if ( APPLE )
add_definitions( -Doff64_t=off_t )
endif ( APPLE )

find_program(
HAVE_SYSTEMD systemd
PATHS /lib/systemd /usr/lib/systemd
NO_DEFAULT_PATH
)
if ( HAVE_SYSTEMD )
add_subdirectory( systemd )
endif( HAVE_SYSTEMD )

add_subdirectory( libgrive )
add_subdirectory( grive )
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM alpine:3.7 as build

RUN apk add make cmake g++ libgcrypt-dev yajl-dev yajl \
boost-dev curl-dev expat-dev cppunit-dev binutils-dev \
pkgconfig

ADD . /grive2

RUN mkdir /grive2/build \
&& cd /grive2/build \
&& cmake .. \
&& make -j4 install

FROM alpine:3.7

RUN apk add yajl libcurl libgcrypt boost-program_options boost-regex libstdc++ boost-system \
&& apk add boost-filesystem --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main

COPY --from=build /usr/local/bin/grive /bin/grive
RUN chmod 777 /bin/grive \
&& mkdir /data

VOLUME /data
WORKDIR /data
ENTRYPOINT grive
171 changes: 151 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,144 @@
# Grive2 0.5.1-dev
# Grive2 0.5.3

28 Sep 2016, Vitaliy Filippov
09 Nov 2022, Vitaliy Filippov

http://yourcmc.ru/wiki/Grive2

This is the fork of original "Grive" (https://github.com/Grive/grive) Google Drive client
with the support for the new Drive REST API and partial sync.

Grive can be considered still beta or pre-beta quality. It simply downloads all the files in your
Google Drive into the current directory. After you make some changes to the local files, run
Grive simply downloads all the files in your Google Drive into the current directory.
After you make some changes to the local files, run
grive again and it will upload your changes back to your Google Drive. New files created locally
or in Google Drive will be uploaded or downloaded respectively. Deleted files will also be "removed".
Currently Grive will NOT destroy any of your files: it will only move the files to a
directory named .trash or put them in the Google Drive trash. You can always recover them.

There are a few things that Grive does not do at the moment:
- continously wait for changes in file system or in Google Drive to occur and upload.
A sync is only performed when you run Grive.
A sync is only performed when you run Grive (there are workarounds for almost
continuous sync. See below).
- symbolic links support.
- support for Google documents.

These may be added in the future, possibly the next release.
These may be added in the future.

Enjoy!

## Usage

When Grive is run for the first time, you should use the "-a" argument to grant
permission to Grive to access to your Google Drive. A URL should be printed.
Go to the link. You will need to login to your Google account if you haven't
done so. After granting the permission to Grive, the browser will show you
an authenication code. Copy-and-paste that to the standard input of Grive.
permission to Grive to access to your Google Drive:

```bash
cd $HOME
mkdir google-drive
cd google-drive
grive -a
```

A URL should be printed. Go to the link. You will need to login to your Google
account if you haven't done so. After granting the permission to Grive, the
authorization code will be forwarded to the Grive application and you will be
redirected to a localhost web page confirming the authorization.

If everything works fine, Grive will create .grive and .grive_state files in your
If everything works fine, Grive will create .grive and .grive\_state files in your
current directory. It will also start downloading files from your Google Drive to
your current directory.

Enjoy!
To resync the direcory, run `grive` in the folder.

```bash
cd $HOME/google-drive
grive
```

### Exclude specific files and folders from sync: .griveignore

Rules are similar to Git's .gitignore, but may differ slightly due to the different
implementation.

- lines that start with # are comments
- leading and trailing spaces ignored unless escaped with \
- non-empty lines without ! in front are treated as "exclude" patterns
- non-empty lines with ! in front are treated as "include" patterns
and have a priority over all "exclude" ones
- patterns are matched against the filenames relative to the grive root
- a/**/b matches any number of subpaths between a and b, including 0
- **/a matches `a` inside any directory
- b/** matches everything inside `b`, but not b itself
- \* matches any number of any characters except /
- ? matches any character except /
- .griveignore itself isn't ignored by default, but you can include it in itself to ignore


### Scheduled syncs and syncs on file change events

There are tools which you can use to enable both scheduled syncs and syncs
when a file changes. Together these gives you an experience almost like the
Google Drive clients on other platforms (it misses the almost instantious
download of changed files in the google drive).

Grive installs such a basic solution which uses inotify-tools together with
systemd timer and services. You can enable it for a folder in your `$HOME`
directory (in this case the `$HOME/google-drive`):

First install the `inotify-tools` (seems to be named like that in all major distros):
test that it works by calling `inotifywait -h`.

Prepare a Google Drive folder in your $HOME directory with `grive -a`.

```bash
# 'google-drive' is the name of your Google Drive folder in your $HOME directory
systemctl --user enable grive@$(systemd-escape google-drive).service
systemctl --user start grive@$(systemd-escape google-drive).service
```

You can enable and start this unit for multiple folders in your `$HOME`
directory if you need to sync with multiple google accounts.

You can also only enable the time based syncing or the changes based syncing
by only directly enabling and starting the corresponding unit:
`grive-changes@$(systemd-escape google-drive).service` or
`grive-timer@$(systemd-escape google-drive).timer`.

### Shared files

Files and folders which are shared with you don't automatically show up in
your folder. They need to be added explicitly to your Google Drive: go to the
Google Drive website, right click on the file or folder and chose 'Add to My
Drive'.

### Different OAuth2 client to workaround over quota and google approval issues

Google recently started to restrict access for unapproved applications:
https://developers.google.com/drive/api/v3/about-auth?hl=ru

Grive2 is currently awaiting approval but it seems it will take forever.
Also even if they approve it the default Client ID supplied with grive may
exceed quota and grive will then fail to sync.

You can supply your own OAuth2 client credentials to work around these problems
by following these steps:

1. Go to https://console.developers.google.com/apis/api/drive.googleapis.com
2. Choose a project (you might need to create one first)
3. Go to https://console.developers.google.com/apis/library/drive.googleapis.com and
"Enable" the Google Drive APIs
4. Go to https://console.cloud.google.com/apis/credentials and click "Create credentials > Help me choose"
5. In the "Find out what credentials you need" dialog, choose:
- Which API are you using: "Google Drive API"
- Where will you be calling the API from: "Other UI (...CLI...)"
- What data will you be accessing: "User Data"
6. In the next steps create a client id (name doesn't matter) and
setup the consent screen (defaults are ok, no need for any URLs)
7. The needed "Client ID" and "Client Secret" are either in the shown download
or can later found by clicking on the created credential on
https://console.developers.google.com/apis/credentials/
8. When you change client ID/secret in an existing Grive folder you must first delete
the old `.grive` configuration file.
9. Call `grive -a --id <client_id> --secret <client_secret>` and follow the steps
to authenticate the OAuth2 client to allow it to access your drive folder.

## Installation

Expand All @@ -57,8 +163,14 @@ There are also some optional dependencies:
On a Debian/Ubuntu/Linux Mint machine just run the following command to install all
these packages:

sudo apt-get install git cmake build-essential libgcrypt11-dev libyajl-dev \
libboost-all-dev libcurl4-openssl-dev libexpat1-dev libcppunit-dev binutils-dev
sudo apt-get install git cmake build-essential libgcrypt20-dev libyajl-dev \
libboost-all-dev libcurl4-openssl-dev libexpat1-dev libcppunit-dev binutils-dev \
debhelper zlib1g-dev dpkg-dev pkg-config

Fedora:

sudo dnf install git cmake libgcrypt-devel gcc-c++ libstdc++ yajl-devel boost-devel libcurl-devel expat-devel binutils zlib


FreeBSD:

Expand All @@ -69,7 +181,7 @@ FreeBSD:
On a Debian/Ubuntu/Linux Mint you can use `dpkg-buildpackage` utility from `dpkg-dev` package
to build grive. Just clone the repository, `cd` into it and run

dpkg-buildpackage -j4
dpkg-buildpackage -j4 --no-sign

### Manual build

Expand All @@ -81,17 +193,35 @@ Grive uses cmake to build. Basic install sequence is
make -j4
sudo make install

Alternativly you can define your own client_id and client_secret during build

mkdir build
cd build
cmake .. "-DAPP_ID:STRING=<client_id>" "-DAPP_SECRET:STRING=<client_secret>"
make -j4
sudo make install

## Version History

### Grive2 v0.5.1-dev
### Grive2 v0.5.3

- Implement Google OAuth loopback IP redirect flow
- Various small fixes

### Grive2 v0.5.1

- Support for .griveignore
- Automatic sync solution based on inotify-tools and systemd
- no-remote-new and upload-only modes
- ignore regexp does not persist anymore (note that Grive will still track it to not
- Ignore regexp does not persist anymore (note that Grive will still track it to not
accidentally delete remote files when changing ignore regexp)
- added options to limit upload and download speed
- faster upload of new and changed files. now Grive uploads files without first calculating
- Added options to limit upload and download speed
- Faster upload of new and changed files. Now Grive uploads files without first calculating
md5 checksum when file is created locally or when its size changes.
- added -P/--progress-bar option to print ASCII progress bar for each processed file (pull request by @svartkanin)
- Added -P/--progress-bar option to print ASCII progress bar for each processed file (pull request by @svartkanin)
- Added command-line options to specify your own client_id and client_secret
- Now grive2 skips links, sockets, fifos and other unusual files
- Various small build fixes

### Grive2 v0.5

Expand Down Expand Up @@ -137,3 +267,4 @@ New features:
- #87: support for revisions
- #86: ~~partial sync (contributed by justin at tierramedia.com)~~ that's not partial sync,
that's only support for specifying local path on command line

10 changes: 2 additions & 8 deletions cmake/Modules/FindBFD.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
find_library( DL_LIBRARY NAMES dl PATH ${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES} )
find_library( BFD_LIBRARY NAMES bfd PATH ${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES} )

if ( DL_LIBRARY AND BFD_LIBRARY )
if ( BFD_LIBRARY )
set( BFD_FOUND TRUE )
endif (DL_LIBRARY AND BFD_LIBRARY)

if ( BFD_FOUND )

message( STATUS "Found libbfd: ${BFD_LIBRARY}")

endif ( BFD_FOUND )
endif ( BFD_LIBRARY )
3 changes: 3 additions & 0 deletions cmake/Modules/FindLibGcrypt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ IF(LIBGCRYPTCONFIG_EXECUTABLE)

EXEC_PROGRAM(${LIBGCRYPTCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_CFLAGS)

string(REPLACE "fgrep: warning: fgrep is obsolescent; using grep -F" "" LIBGCRYPT_LIBRARIES "${LIBGCRYPT_LIBRARIES}")
string(STRIP "${LIBGCRYPT_LIBRARIES}" LIBGCRYPT_LIBRARIES)

IF(${LIBGCRYPT_CFLAGS} MATCHES "\n")
SET(LIBGCRYPT_CFLAGS " ")
ENDIF(${LIBGCRYPT_CFLAGS} MATCHES "\n")
Expand Down
63 changes: 63 additions & 0 deletions completion.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#compdef grive
# ------------------------------------------------------------------------------
# Copyright (c) 2015 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Grive (https://github.com/vitalif/grive2)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Doron Behar <https://github.com/doronbehar>
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------

local curcontext="$curcontext" state line ret=1
typeset -A opt_args

_arguments -C \
'(-h --help)'{-h,--help}'[Produce help message]' \
'(-v --version)'{-v,--version}'[Display Grive version]' \
'(-a --auth)'{-a,--auth}'[Request authorization token]' \
'(-p --path)'{-p,--path}'[Root directory to sync]' \
'(-s --dir)'{-s,--dir}'[Single subdirectory to sync (remembered for next runs)]' \
'(-V --verbose)'{-V,--verbose}'[Verbose mode. Enable more messages than normal.]' \
'(--log-http)--log-http[Log all HTTP responses in this file for debugging.]' \
'(--new-rev)--new-rev[Create,new revisions in server for updated files.]' \
'(-d --debug)'{-d,--debug}'[Enable debug level messages. Implies -v.]' \
'(-l --log)'{-l,--log}'[Set log output filename.]' \
'(-f --force)'{-f,--force}'[Force grive to always download a file from Google Drive instead of uploading it.]' \
'(--dry-run)--dry-run[Only,detect which files need to be uploaded/downloaded,without actually performing them.]' \
'(--ignore)--ignore[Perl,RegExp to ignore files (matched against relative paths, remembered for next runs) ]' \
'*: :_files' && ret=0

return ret
Loading