Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
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
nodes
typescript
duniter
Commits
bb180336
Commit
bb180336
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#1037
CLI file not deleted
parent
0a5b89c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/cli.js
+0
-88
0 additions, 88 deletions
app/cli.js
with
0 additions
and
88 deletions
app/cli.js
deleted
100644 → 0
+
0
−
88
View file @
0a5b89c9
"
use strict
"
;
var
__awaiter
=
(
this
&&
this
.
__awaiter
)
||
function
(
thisArg
,
_arguments
,
P
,
generator
)
{
return
new
(
P
||
(
P
=
Promise
))(
function
(
resolve
,
reject
)
{
function
fulfilled
(
value
)
{
try
{
step
(
generator
.
next
(
value
));
}
catch
(
e
)
{
reject
(
e
);
}
}
function
rejected
(
value
)
{
try
{
step
(
generator
[
"
throw
"
](
value
));
}
catch
(
e
)
{
reject
(
e
);
}
}
function
step
(
result
)
{
result
.
done
?
resolve
(
result
.
value
)
:
new
P
(
function
(
resolve
)
{
resolve
(
result
.
value
);
}).
then
(
fulfilled
,
rejected
);
}
step
((
generator
=
generator
.
apply
(
thisArg
,
_arguments
||
[])).
next
());
});
};
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
const
Command
=
require
(
'
commander
'
).
Command
;
const
pjson
=
require
(
'
../package.json
'
);
const
duniter
=
require
(
'
../index
'
);
exports
.
ExecuteCommand
=
()
=>
{
const
options
=
[];
const
commands
=
[];
return
{
addOption
:
(
optFormat
,
optDesc
,
optParser
)
=>
options
.
push
({
optFormat
,
optDesc
,
optParser
}),
addCommand
:
(
command
,
executionCallback
)
=>
commands
.
push
({
command
,
executionCallback
}),
// To execute the provided command
execute
:
(
programArgs
)
=>
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
const
program
=
new
Command
();
// Callback for command success
let
onResolve
;
// Callback for command rejection
let
onReject
=
()
=>
Promise
.
reject
(
Error
(
"
Uninitilized rejection throw
"
));
// Command execution promise
const
currentCommand
=
new
Promise
((
resolve
,
reject
)
=>
{
onResolve
=
resolve
;
onReject
=
reject
;
});
program
.
version
(
pjson
.
version
)
.
usage
(
'
<command> [options]
'
)
.
option
(
'
--home <path>
'
,
'
Path to Duniter HOME (defaults to "$HOME/.config/duniter").
'
)
.
option
(
'
-d, --mdb <name>
'
,
'
Database name (defaults to "duniter_default").
'
)
.
option
(
'
--autoconf
'
,
'
With `config` and `init` commands, will guess the best network and key options witout asking for confirmation
'
)
.
option
(
'
--addep <endpoint>
'
,
'
With `config` command, add given endpoint to the list of endpoints of this node
'
)
.
option
(
'
--remep <endpoint>
'
,
'
With `config` command, remove given endpoint to the list of endpoints of this node
'
)
.
option
(
'
--cpu <percent>
'
,
'
Percent of CPU usage for proof-of-work computation
'
,
parsePercent
)
.
option
(
'
-c, --currency <name>
'
,
'
Name of the currency managed by this node.
'
)
.
option
(
'
--nostdout
'
,
'
Disable stdout printing for `export-bc` command
'
)
.
option
(
'
--noshuffle
'
,
'
Disable peers shuffling for `sync` command
'
)
.
option
(
'
--timeout <milliseconds>
'
,
'
Timeout to use when contacting peers
'
,
parseInt
)
.
option
(
'
--httplogs
'
,
'
Enable HTTP logs
'
)
.
option
(
'
--nohttplogs
'
,
'
Disable HTTP logs
'
)
.
option
(
'
--isolate
'
,
'
Avoid the node to send peering or status informations to the network
'
)
.
option
(
'
--forksize <size>
'
,
'
Maximum size of fork window
'
,
parseInt
)
.
option
(
'
--memory
'
,
'
Memory mode
'
);
for
(
const
opt
of
options
)
{
program
.
option
(
opt
.
optFormat
,
opt
.
optDesc
,
opt
.
optParser
);
}
for
(
const
cmd
of
commands
)
{
program
.
command
(
cmd
.
command
.
name
)
.
description
(
cmd
.
command
.
desc
)
.
action
(
function
()
{
return
__awaiter
(
this
,
arguments
,
void
0
,
function
*
()
{
const
args
=
Array
.
from
(
arguments
);
try
{
const
resOfExecution
=
yield
cmd
.
executionCallback
.
apply
(
null
,
[
program
].
concat
(
args
));
onResolve
(
resOfExecution
);
}
catch
(
e
)
{
onReject
(
e
);
}
});
});
}
program
.
on
(
'
*
'
,
function
(
cmd
)
{
console
.
log
(
"
Unknown command '%s'. Try --help for a listing of commands & options.
"
,
cmd
);
onResolve
();
});
program
.
parse
(
programArgs
);
if
(
programArgs
.
length
<=
2
)
{
onReject
(
'
No command given.
'
);
}
return
currentCommand
;
})
};
};
function
parsePercent
(
s
)
{
const
f
=
parseFloat
(
s
);
return
isNaN
(
f
)
?
0
:
f
;
}
//# sourceMappingURL=cli.js.map
\ 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