Skip to content

Commit 8b28060

Browse files
committed
yanglint FEATURE interactive context implemented flags
Refs #1706
1 parent c2a5a0c commit 8b28060

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

tools/lint/cmd_clear.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@
2828
void
2929
cmd_clear_help(void)
3030
{
31-
printf("Usage: clear [--yang-library]\n"
31+
printf("Usage: clear [-i] [-y]\n"
3232
" Replace the current context with an empty one, searchpaths\n"
33-
" are not kept.\n"
33+
" are not kept.\n\n"
34+
" -i, --makeimplemented\n"
35+
" Make the imported modules \"referenced\" from any loaded\n"
36+
" module also implemented. If specified a second time, all the\n"
37+
" modules are set implemented.\n"
3438
" -y, --yang-library\n"
3539
" Load and implement internal \"ietf-yang-library\" YANG module.\n"
3640
" Note that this module includes definitions of mandatory state\n"
@@ -48,6 +52,7 @@ cmd_clear(struct ly_ctx **ctx, const char *cmdline)
4852
char **argv = NULL;
4953
int opt, opt_index;
5054
struct option options[] = {
55+
{"makeimplemented", no_argument, NULL, 'i'},
5156
{"yang-library", no_argument, NULL, 'y'},
5257
{"help", no_argument, NULL, 'h'},
5358
{NULL, 0, NULL, 0}
@@ -59,8 +64,16 @@ cmd_clear(struct ly_ctx **ctx, const char *cmdline)
5964
goto cleanup;
6065
}
6166

62-
while ((opt = getopt_long(argc, argv, "yh", options, &opt_index)) != -1) {
67+
while ((opt = getopt_long(argc, argv, "iyh", options, &opt_index)) != -1) {
6368
switch (opt) {
69+
case 'i':
70+
if (options_ctx & LY_CTX_REF_IMPLEMENTED) {
71+
options_ctx &= ~LY_CTX_REF_IMPLEMENTED;
72+
options_ctx |= LY_CTX_ALL_IMPLEMENTED;
73+
} else {
74+
options_ctx |= LY_CTX_REF_IMPLEMENTED;
75+
}
76+
break;
6477
case 'y':
6578
options_ctx &= ~LY_CTX_NO_YANGLIBRARY;
6679
break;

0 commit comments

Comments
 (0)