https://github.com/r-lib/xopen
Open System Files, URLs, Anything
https://github.com/r-lib/xopen
Last synced: 10 days ago
JSON representation
Open System Files, URLs, Anything
- Host: GitHub
- URL: https://github.com/r-lib/xopen
- Owner: r-lib
- License: other
- Created: 2018-09-10T08:11:47.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-11-09T14:02:53.000Z (5 months ago)
- Last Synced: 2025-03-28T21:03:51.628Z (17 days ago)
- Language: Shell
- Homepage: https://r-lib.github.io/xopen/
- Size: 1.2 MB
- Stars: 31
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - r-lib/xopen - Open System Files, URLs, Anything (Shell)
README
# xopen
> Open System Files, URLs, Anything
[](https://github.com/r-lib/xopen/actions/workflows/R-CMD-check.yaml)
[](https://www.r-pkg.org/pkg/xopen)
[](https://www.r-pkg.org/pkg/xopen)
[](https://app.codecov.io/gh/r-lib/xopen)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