Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ThinkR-open/prompt

Dynamic prompt
https://github.com/ThinkR-open/prompt

console prompt r

Last synced: 3 months ago
JSON representation

Dynamic prompt

Awesome Lists containing this project

README

        

---
title: "prompt"
author: Romain Francois
output:
md_document:
variant: markdown_github
---

```{r, echo=FALSE, print=FALSE}
library("prompt")
```

![](prompt.png)

# prompt

Dynamic Prompt.

# Usage

This use `glue` to expand the function passed in, with the follwing bindings available:

- `t` the current time, in format "%H:%M:%S"
- `v` the version of R
- `V` the version of R, including the svn revision
- `u` the user name
- `g` the github user name
- `m` the memory currently used by R
- `w` the current working directory

```{r eval = FALSE}
set_prompt( ~ "{t}> " )
set_prompt( ~ "{w}> " )
set_prompt( ~ "[{m}] {t} {w}> ")
```

You can use `expand_prompt` to experiment :

```{r}
expand_prompt( ~ "{t}> " )
expand_prompt( ~ "{w}> " )
expand_prompt( ~ "[{m}] {t} {w}> ")
```

## Installation

```
install_github( "ThinkR-open/prompt" )
```

## Initial ideas

in a way that can be configured. Things we might want to display:

- current time
- memory used `pryr::mem_used`
- current working directory, maybe slightly differently when it's not the directory of the current rstudio project
- are we developping a package ? Do we need to rebuild it ?
- are we sync with github
- R version
- ...
- (please add your own with PR)

## License

MIT + file LICENSE ©