Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
perso-distributed-systems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xavier.perret
perso-distributed-systems
Commits
5a63f762
Commit
5a63f762
authored
2 years ago
by
Xavier Perret
Browse files
Options
Downloads
Patches
Plain Diff
improved clients
parent
8ebb6ef3
No related branches found
No related tags found
1 merge request
!2
added file to separate client function from the server
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/client.go
+33
-0
33 additions, 0 deletions
app/client.go
with
33 additions
and
0 deletions
app/client.go
+
33
−
0
View file @
5a63f762
package
main
package
main
import
(
import
(
"fmt"
"gopkg.in/yaml.v3"
command_line
"node/command-line"
.
"node/types"
.
"node/types"
"node/utilities"
"os"
)
)
/*
/*
...
@@ -12,5 +17,33 @@ import (
...
@@ -12,5 +17,33 @@ import (
*/
*/
func
main
()
{
func
main
()
{
argsLen
:=
len
(
os
.
Args
)
isThereEnoughArgs
:=
argsLen
<=
1
if
isThereEnoughArgs
{
fmt
.
Println
(
"First argument should be the path of the config file '--path=<config.yaml>'"
)
os
.
Exit
(
1
)
}
// init configuration
args
:=
os
.
Args
[
1
:
]
fmt
.
Println
(
"Program started with arguments"
,
args
)
fmt
.
Println
(
"config file path is "
,
args
[
0
][
7
:
])
buf
,
err
:=
os
.
ReadFile
(
args
[
0
][
7
:
])
if
err
!=
nil
{
fmt
.
Println
(
"Error while reading the config file"
,
err
)
fmt
.
Println
(
"Exiting..."
)
os
.
Exit
(
1
)
}
var
clientConfig
Config
err
=
yaml
.
Unmarshal
(
buf
,
&
clientConfig
)
if
err
!=
nil
{
os
.
Exit
(
1
)
}
utilities
.
PrintConfig
(
clientConfig
)
command_line
.
ClientUserInputLoop
(
clientConfig
,
true
)
}
}
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