Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rust-swerve
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Louis
rust-swerve
Commits
b4b1fd82
Unverified
Commit
b4b1fd82
authored
7 years ago
by
Louis
Browse files
Options
Downloads
Patches
Plain Diff
Support --upload and --upload-path flags in arg parser, implement mock config file
parent
658d76d7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cli/cli.rs
+4
-0
4 additions, 0 deletions
src/cli/cli.rs
src/cli/config_file.rs
+28
-0
28 additions, 0 deletions
src/cli/config_file.rs
src/cli/mod.rs
+3
-1
3 additions, 1 deletion
src/cli/mod.rs
with
35 additions
and
1 deletion
src/cli/cli.rs
+
4
−
0
View file @
b4b1fd82
...
@@ -14,6 +14,8 @@ Options:
...
@@ -14,6 +14,8 @@ Options:
-a=<addr>, --address=<addr> Address to bind to (e.g. 10.0.0.15); defaults to localhost
-a=<addr>, --address=<addr> Address to bind to (e.g. 10.0.0.15); defaults to localhost
-c=<path>, --config=<path> Path to the .swerve config file
-c=<path>, --config=<path> Path to the .swerve config file
-t=<num>, --threads=<num> Number of worker threads to use for serving files; defaults to 32
-t=<num>, --threads=<num> Number of worker threads to use for serving files; defaults to 32
-u, --upload Support file uploads to '/upload'
-U=<path>, --upload-path=<path> Set the url path that will accept file uploads. Implies -u if not present
"
;
"
;
#[derive(Debug,
Deserialize,
Clone)]
#[derive(Debug,
Deserialize,
Clone)]
...
@@ -26,4 +28,6 @@ pub struct Args {
...
@@ -26,4 +28,6 @@ pub struct Args {
pub
flag_help
:
bool
,
pub
flag_help
:
bool
,
pub
flag_quiet
:
bool
,
pub
flag_quiet
:
bool
,
pub
flag_no_index
:
bool
,
pub
flag_no_index
:
bool
,
pub
flag_upload
:
bool
,
pub
flag_upload_path
:
Option
<
String
>
,
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/cli/config_file.rs
0 → 100644
+
28
−
0
View file @
b4b1fd82
use
std
::
path
::
Path
;
use
std
::
convert
::
AsRef
;
use
std
::
io
::
prelude
::
*
;
use
std
::
io
;
use
std
::
fs
::
File
;
pub
enum
HandlerMethod
{
Log
,
File
,
}
pub
struct
SwerveConfig
{
pub
field_handling
:
HandlerMethod
,
pub
file_handling
:
HandlerMethod
,
}
impl
SwerveConfig
{
pub
fn
from_file
<
P
>
(
path
:
P
)
->
io
::
Result
<
SwerveConfig
>
where
P
:
AsRef
<
Path
>
{
// let mut file = File::open(path)?;
// let mut buffer = String::new();
// file.read_to_string(buffer)?;
Ok
(
SwerveConfig
{
field_handling
:
HandlerMethod
::
Log
,
file_handling
:
HandlerMethod
::
Log
,
})
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/cli/mod.rs
+
3
−
1
View file @
b4b1fd82
mod
cli
;
mod
cli
;
mod
config_file
;
pub
use
self
::
cli
::{
Args
,
USAGE
};
pub
use
self
::
cli
::{
Args
,
USAGE
};
\ No newline at end of file
pub
use
self
::
config_file
::{
HandlerMethod
,
SwerveConfig
};
\ No newline at end of file
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