Browse Source

reachable

master
boB Rudis 4 months ago
parent
commit
19dbe380a0
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
4 changed files with 30 additions and 2 deletions
  1. +1
    -0
      NAMESPACE
  2. +11
    -0
      R/reachable.R
  3. +4
    -2
      README.md
  4. +14
    -0
      man/reachable.Rd

+ 1
- 0
NAMESPACE View File

@@ -9,6 +9,7 @@ export(bitbar_plugins_dir)
export(new_bitbar_script)
export(open_bitbar_dir)
export(r_logo_small)
export(reachable)
import(httr)
import(miniUI)
import(shiny)


+ 11
- 0
R/reachable.R View File

@@ -0,0 +1,11 @@
#' Is the internet accessible?
#'
#' @param fqdn_or_ip FQDN or ip to use for reachability testing. defaults to google dns
#' @export
reachable <- function(fqdn_or_ip = "8.8.8.8") {

res <- sys::exec_internal("/usr/sbin/scutil", args = c("-r", fqdn_or_ip[1]))

return(res$status == 0)

}

+ 4
- 2
README.md View File

@@ -45,6 +45,7 @@ performance).
The following functions are implemented:

- `add_entry`: Add an entry to the menu
- `applescript`: Execute AppleScript and Return Results
- `b64_image`: Return a base64 encoded string of an image (local
filesystem or URL)
- `bitbar_plugins_dir`: BitBar plugins directory
@@ -52,6 +53,7 @@ The following functions are implemented:
script
- `open_bitbar_dir`: Open BitBar Plugins Directory in the Finder
- `r_logo_small`: Images that come with the package
- `reachable`: Is the internet accessible?

There are also two RStudio Addins, one with a GUI for entering in the
script metadata & starting a new BitBar {bitbar} script and one for
@@ -99,8 +101,8 @@ new_bitbar_script(

| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
| R | 10 | 0.91 | 191 | 0.94 | 51 | 0.69 | 79 | 0.66 |
| Rmd | 1 | 0.09 | 13 | 0.06 | 23 | 0.31 | 41 | 0.34 |
| R | 12 | 0.92 | 221 | 0.94 | 63 | 0.73 | 122 | 0.75 |
| Rmd | 1 | 0.08 | 13 | 0.06 | 23 | 0.27 | 41 | 0.25 |

## Code of Conduct



+ 14
- 0
man/reachable.Rd View File

@@ -0,0 +1,14 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/reachable.R
\name{reachable}
\alias{reachable}
\title{Is the internet accessible?}
\usage{
reachable(fqdn_or_ip = "8.8.8.8")
}
\arguments{
\item{fqdn_or_ip}{FQDN or ip to use for reachability testing. defaults to google dns}
}
\description{
Is the internet accessible?
}

Loading…
Cancel
Save