From aab5bfd074e57d06a79e39d7c7c4760e1f385a06 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 17 Oct 2022 21:41:28 -0500 Subject: Bankruptcy 9 --- lisp/gdrive.el | 130 --------------------------------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 lisp/gdrive.el (limited to 'lisp/gdrive.el') diff --git a/lisp/gdrive.el b/lisp/gdrive.el deleted file mode 100644 index 41a3660..0000000 --- a/lisp/gdrive.el +++ /dev/null @@ -1,130 +0,0 @@ -;;; gdrive.el --- Gdrive integration -*- lexical-binding: t; -*- - -;; Copyright (C) 2022 Case Duckworth - -;; Author: Case Duckworth -;; Keywords: convenience, data, docs - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; [[https://github.com/prasmussen/gdrive][gdrive]] is a Go program to interface with Google Drive. This library connects -;; that to Emacs. - -;;; Code: - -(require 'cl-lib) - -(defgroup gdrive nil - "Customizations for Emacs's gdrive module." - :group 'applications - :prefix "gdrive-") - -(defcustom gdrive-bin (executable-find "gdrive") - "Where gdrive binary is located." - :type 'string) - -(defcustom gdrive-buffer "*gdrive*" - "Default buffer for gdrive output." - :type 'string) - -;;; Global flags - -;;;; -c, --config -;;;;; Application path, default: /Users//.gdrive -(defcustom gdrive-config-dir nil - "Application path.") - -;;;; --refresh-token -;;;;; Oauth refresh token used to get access token (for advanced users) -(defcustom gdrive-refresh-token nil - "Oauth refresh token used to get access token. -(For advanced users).") - -;;;; --access-token -;;;;; Oauth access token, only recommended for short-lived requests because of -;;;;; short lifetime (for advanced users) -(defcustom gdrive-access-token nil - "Oauth access token. -Only recommended for short-lived requests because of short -lifetime (for advanced users).") - -;;;; --service-account -;;;;; Oauth service account filename, used for server to server communication -;;;;; without user interaction (file is relative to config dir) -(defcustom gdrive-service-account nil - "Oauth service account filename. -Used for server to server communication without user -interaction (file is relative to config dir).") - -(defun gdrive--global-arguments () - "Build global arguments for gdrive." - (append - (when gdrive-config-dir (list "--config" gdrive-config-dir)) - (when gdrive-refresh-token (list "--refresh-token" gdrive-refresh-token)) - (when gdrive-access-token (list "--access-token" gdrive-access-token)) - (when gdrive-service-account (list "--service-account" gdrive-service-account)))) - -;;; List files -;; gdrive [global] list [options] -;;;; -m, --max -;;;; Max files to list, default: 30 -;;;; -q, --query -;;;;; Default query: "trashed = false and 'me' in owners". See https://developers.google.com/drive/search-parameters -;;;; --order -;;;;; Sort order. See https://godoc.org/google.golang.org/api/drive/v3#FilesListCall.OrderBy -;;;; --name-width -;;;;; Width of name column, default: 40, minimum: 9, use 0 for full width -;; NOTE: gdrive-list will pass 0 for this argument. -;;;; --absolute Show absolute path to file (will only show path from first parent) -;;;; --no-header Dont print the header -;; NOTE: gdrive-list will always pass this argument. -;;;; --bytes Size in bytes -(cl-defun gdrive-list (&key max query order absolute no-header bytes) - "Run the \"gdrive list\" command. -MAX is the max files to list; it defaults to 30. QUERY is the -query to pass; the default is \"trashed = false and 'me' in -owners\"." - (gdrive--run (append (gdrive--global-arguments) - (list "list") - (when max (list "--max" max)) - (when query (list "--query" query)) - (when order (list "--order" order)) - (list "--name-width" "0") - (when absolute (list "--absolute")) - (when no-header (list "--no-header")) - (when bytes (list "--bytes"))))) - - -(defmacro gdrive-query) - - -(defun gdrive--build-command-name (command) - "INTERNAL: Build a string name for COMMAND." - (concat "gdrive-" (car command))) - -(defun gdrive--run (command &optional buffer) - "Run 'gdrive COMMAND', collecting results in BUFFER. -COMMAND, if not a list, will be made a list and appended to -`gdrive-bin'. -BUFFER defaults to `gdrive-buffer'." - (let ((command (if (listp command) command (list command))) - (buffer (or buffer gdrive-buffer))) - (make-process :name (gdrive--build-command-name command) - :buffer buffer - :command (cons gdrive-bin command)))) - -(provide 'gdrive) -;;; gdrive.el ends here -- cgit 1.4.1-21-gabe81