forked from gaborcsardi/prompt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
110 lines (78 loc) · 2.51 KB
/
README.Rmd
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
output:
github_document:
html_preview: false
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
options(tibble.print_min = 5, tibble.print_max = 5)
```
# promptr
> Dynamic R Prompt
[![Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](http://www.repostatus.org/badges/latest/wip.svg)](http://www.repostatus.org/#wip)
## Overview
This package is a fork from ["gaborcsardi/prompt"](https://github.com/gaborcsardi/prompt).
It is adjusted so that it works under WINDOWS.
Prompts are modified to personal preferences.
## Installation
```{r, eval = FALSE}
# Install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("cstepper/promptr")
```
## Original notes from Gabor Csardi
![](man/figures/prompt-screenshot.png)
Set the R prompt dynamically, from a function. The package contains some
examples. The prompt on the screenshot has:
* The status of the last command (success or failure).
* The amount of memory allocated by the current R process.
* The name of the R package being developed using
[devtools](https://github.com/hadley/devtools).
* Name of the active git branch.
* State of the git working tree (needs pushes, pulls, and/or dirty).
Use the `prompt_fancy` prompt, as on the screenshot, or create your own.
```r
library(prompt)
set_prompt(prompt_fancy)
```
## Usage
Use the `prompt_fancy`, if you'd like to get information about the
* status of the last command (success or failure).
* amount of memory allocated by the current R process.
* name of the active git branch.
* state of the git working tree (needs pushes, pulls, and/or dirty).
```{r, eval=FALSE}
library('promptr')
set_prompt(prompt_fancy)
```
![](man/figures/promptr_fancy-screenshot.png)
Alternatively, you can choose `prompt_memuse` for the memory allocation
info only, or `prompt_git` for info on the current status of your git branch.
Change the prompt with:
```{r}
library('promptr')
# set prompt
set_prompt(prompt_memuse)
# disable again
suspend()
# set another prompt
set_prompt(prompt_git)
# disable again
suspend()
```
## Notes
If you'd like to use any prompt permanenty, you can modify
your `~/Documents/.Rprofile` with something like this:
```{bash, eval=FALSE}
.First <- function() {
if (interactive() == TRUE) {
library("promptr")
set_prompt(prompt_memuse)
}
}
```