File: README.md

package info (click to toggle)
r-cran-xopen 1.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 124 kB
  • sloc: sh: 13; makefile: 2
file content (76 lines) | stat: -rw-r--r-- 1,494 bytes parent folder | download
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

# xopen

> Open System Files, URLs, Anything

<!-- badges: start -->
[![R-CMD-check](https://github.com/r-lib/xopen/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/xopen/actions/workflows/R-CMD-check.yaml)
[![](https://www.r-pkg.org/badges/version/xopen)](https://www.r-pkg.org/pkg/xopen)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/xopen)](https://www.r-pkg.org/pkg/xopen)
[![Codecov test coverage](https://codecov.io/gh/r-lib/xopen/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/xopen?branch=main)
<!-- badges: end -->

Cross platform solution to open files, directories or URLs with their
associated programs. Inspired by `shell.exec()`,
https://github.com/pwnall/node-open and
https://github.com/sindresorhus/opn

## Installation

Stable version:

```r
install.packages("xopen")
```

Development version:

```r
pak::pak("r-lib/xopen")
```

## Usage

```r
library(xopen)
```

Open a file:

```r
xopen("test.R")
```

Open a URL:

```r
xopen("https://ps.r-lib.org")
```

URL with given app:

```r
chrome <- function() {
  switch(
    get_os(),
    win = "Chrome",
    macos = "google chrome",
    other = "google-chrome")
}
xopen("https://processx.r-lib.org", app = chrome())
```

Open a given app (or switch to it, if already open):

```r
xopen(app = chrome())
```

App and arguments. (You need to quit Chrome for this to work):
```r
xopen(app = c(chrome(), "--incognito", "https://github.com"))
```

## License

MIT © RStudio