update: Update/modify a gist

Description Usage Arguments Value Examples

View source: R/update.R

Description

Update/modify a gist

Usage

1
update(gist, description = gist$description, ...)

Arguments

gist

A gist object or something coerceable to a gist

description

(character) Brief description of gist (optional)

...

Curl options passed on to verb-GET

Value

an object of class gist

Examples

 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
## Not run: 
file1 <- system.file("examples", "alm.md", package = "gistr")
file2 <- system.file("examples", "zoo.json", package = "gistr")

# add new files
gists(what = "minepublic")[[3]] %>%
 add_files(file1, file2) %>%
 update()

# update existing files
### file name has to match to current name
gists(what = "minepublic")[[3]] %>%
 update_files(file1) %>%
 update()

# delete existing files
### again, file name has to match to current name
gists(what = "minepublic")[[3]] %>%
 delete_files(file1, file2) %>%
 update()

# rename existing files
# For some reason, this operation has to upload the content too
### first name is old file name with path (must match), and second is 
### new file name (w/o path)
## add first
gists(what = "minepublic")[[3]] %>%
 add_files(file1, file2) %>%
 update()
## then rename
gists(what = "minepublic")[[3]] %>%
 rename_files(list(file1, "newfile.md")) %>%
 update()
### you can pass in many renames
gists(what = "minepublic")[[3]] %>%
 rename_files(list(file1, "what.md"), list(file2, "new.json")) %>%
 update()

## End(Not run)

gistr documentation built on July 29, 2020, 9:07 a.m.