2828void
2929cmd_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