Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Proost
Manage
Activity
Members
Labels
Plan
Issues
33
Issue boards
Milestones
Code
Merge requests
18
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
loutr
Proost
Merge requests
!37
Resolve "Add functionnalities to proost (toplevel)"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Add functionnalities to proost (toplevel)"
39-add-functionnalities-to-proost-toplevel
into
main
Overview
46
Commits
23
Pipelines
22
Changes
5
Merged
aalbert
requested to merge
39-add-functionnalities-to-proost-toplevel
into
main
2 years ago
Overview
46
Commits
23
Pipelines
22
Changes
5
Expand
Closes
#39 (closed)
Edited
2 years ago
by
v-lafeychine
👍
0
👎
0
Merge request reports
Compare
main
version 20
df5ae438
2 years ago
version 19
4e172e3d
2 years ago
version 18
47ac257a
2 years ago
version 17
5fc0e8f3
2 years ago
version 16
d0f21663
2 years ago
version 15
82c41183
2 years ago
version 14
3c495e50
2 years ago
version 13
e01ad592
2 years ago
version 12
d920a8aa
2 years ago
version 11
52c2d82f
2 years ago
version 10
8ef63450
2 years ago
version 9
b792555f
2 years ago
version 8
cdab51e0
2 years ago
version 7
c973f71a
2 years ago
version 6
c09ea5af
2 years ago
version 5
ac0f5541
2 years ago
version 4
1dc72e46
2 years ago
version 3
0e2b3ab0
2 years ago
version 2
bfa39c4d
2 years ago
version 1
13ca3f1e
2 years ago
main (base)
and
latest version
latest version
ffa57f71
23 commits,
2 years ago
version 20
df5ae438
22 commits,
2 years ago
version 19
4e172e3d
21 commits,
2 years ago
version 18
47ac257a
19 commits,
2 years ago
version 17
5fc0e8f3
18 commits,
2 years ago
version 16
d0f21663
17 commits,
2 years ago
version 15
82c41183
16 commits,
2 years ago
version 14
3c495e50
15 commits,
2 years ago
version 13
e01ad592
14 commits,
2 years ago
version 12
d920a8aa
13 commits,
2 years ago
version 11
52c2d82f
12 commits,
2 years ago
version 10
8ef63450
11 commits,
2 years ago
version 9
b792555f
10 commits,
2 years ago
version 8
cdab51e0
8 commits,
2 years ago
version 7
c973f71a
7 commits,
2 years ago
version 6
c09ea5af
6 commits,
2 years ago
version 5
ac0f5541
5 commits,
2 years ago
version 4
1dc72e46
4 commits,
2 years ago
version 3
0e2b3ab0
3 commits,
2 years ago
version 2
bfa39c4d
2 commits,
2 years ago
version 1
13ca3f1e
1 commit,
2 years ago
5 files
+
272
−
20
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
proost/src/main.rs
+
33
−
17
Options
#![feature(box_syntax)]
#![feature(let_chains)]
mod
process
;
mod
rustyline_helper
;
use
std
::
fs
;
use
atty
::
Stream
;
use
clap
::
Parser
;
use
rustyline
::
error
::
ReadlineError
;
use
rustyline
::{
Cmd
,
Editor
,
EventHandler
,
KeyCode
,
KeyEvent
,
Modifiers
,
Result
};
use
rustyline_helper
::
*
;
use
kernel
::
Environment
;
use
process
::
*
;
use
rustyline
::
error
::
ReadlineError
;
use
rustyline
::
Editor
;
use
std
::
error
::
Error
;
use
std
::
fs
;
// clap configuration
#[derive(Parser)]
#[command(author,
version,
about,
long_about
=
None)]
struct
Args
{
/// some .mdln files
files
:
Vec
<
String
>
,
/// remove syntax highlighting
#[arg(long)]
no_color
:
bool
,
}
// constants fetching
const
VERSION
:
&
str
=
env!
(
"CARGO_PKG_VERSION"
);
const
NAME
:
&
str
=
env!
(
"CARGO_PKG_NAME"
);
fn
main
()
->
Result
<
()
,
Box
<
dyn
Error
>
>
{
fn
main
()
->
Result
<
()
>
{
let
args
=
Args
::
parse
();
// check if files are inputed
if
!
args
.files
.is_empty
()
{
for
path
in
args
.files
.iter
()
{
match
fs
::
read_to_string
(
path
)
{
@@ -36,8 +44,22 @@ fn main() -> Result<(), Box<dyn Error>> {
return
Ok
(());
}
let
mut
rl_err
:
Option
<
ReadlineError
>
=
None
;
let
mut
rl
=
Editor
::
<
()
>
::
new
()
?
;
// check if we are in a terminal
if
atty
::
isnt
(
Stream
::
Stdout
)
||
atty
::
isnt
(
Stream
::
Stdin
)
{
return
Ok
(());
}
let
helper
=
RustyLineHelper
::
new
(
!
args
.no_color
);
let
mut
rl
=
Editor
::
<
RustyLineHelper
>
::
new
()
?
;
rl
.set_helper
(
Some
(
helper
));
rl
.bind_sequence
(
KeyEvent
::
from
(
'\t'
),
EventHandler
::
Conditional
(
Box
::
new
(
TabEventHandler
)),
);
rl
.bind_sequence
(
KeyEvent
(
KeyCode
::
Enter
,
Modifiers
::
ALT
),
EventHandler
::
Simple
(
Cmd
::
Newline
),
);
println!
(
"Welcome to {} {}"
,
NAME
,
VERSION
);
let
mut
env
=
Environment
::
new
();
@@ -52,14 +74,8 @@ fn main() -> Result<(), Box<dyn Error>> {
Ok
(
_
)
=>
(),
Err
(
ReadlineError
::
Interrupted
)
=>
{}
Err
(
ReadlineError
::
Eof
)
=>
break
,
Err
(
err
)
=>
{
rl_err
=
Some
(
err
);
break
;
}
Err
(
err
)
=>
return
Err
(
err
),
}
}
match
rl_err
{
None
=>
Ok
(()),
Some
(
err
)
=>
Err
(
box
err
),
}
Ok
(())
}
Loading