Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Commits
fbc837c0
Commit
fbc837c0
authored
8 years ago
by
kkawakam
Browse files
Options
Downloads
Patches
Plain Diff
Remove ANSI escape sequence from example if on windows
parent
ac7b94f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/example.rs
+10
-1
10 additions, 1 deletion
examples/example.rs
history.txt
+4
-0
4 additions, 0 deletions
history.txt
with
14 additions
and
1 deletion
examples/example.rs
+
10
−
1
View file @
fbc837c0
...
...
@@ -4,6 +4,15 @@ use rustyline::completion::FilenameCompleter;
use
rustyline
::
error
::
ReadlineError
;
use
rustyline
::
Editor
;
// On unix platforms you can use ANSI escape sequences
#[cfg(unix)]
static
PROMPT
:
&
'static
str
=
"
\x1b
[1;32m>>
\x1b
[0m "
;
// Windows consoles typically don't support ANSI escape sequences out
// of the box
#[cfg(windows)]
static
PROMPT
:
&
'static
str
=
">> "
;
fn
main
()
{
let
c
=
FilenameCompleter
::
new
();
let
mut
rl
=
Editor
::
new
();
...
...
@@ -12,7 +21,7 @@ fn main() {
println!
(
"No previous history."
);
}
loop
{
let
readline
=
rl
.readline
(
"
\x1b
[1;32m>>
\x1b
[0m "
);
let
readline
=
rl
.readline
(
PROMPT
);
match
readline
{
Ok
(
line
)
=>
{
rl
.add_history_entry
(
&
line
);
...
...
This diff is collapsed.
Click to expand it.
history.txt
0 → 100644
+
4
−
0
View file @
fbc837c0
asdadsasddsdfasdfasdfsfds
adsdsfafasdfasdfasdf
af
ls
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment