📄 zsh.cpp
字号:
list = list.append( range.first->second ); ++range.first; } asprintf( &psz_arguments, "(%s)", list.c_str() ); } break; case CONFIG_ITEM_MODULE_CAT: { std::pair<mcmap::iterator, mcmap::iterator> range = mods2.equal_range( p_item->min.i ); std::string list = (*range.first).second; ++range.first; while( range.first != range.second ) { list = list.append( " " ); list = list.append( range.first->second ); ++range.first; } asprintf( &psz_arguments, "(%s)", list.c_str() ); } break; case CONFIG_ITEM_MODULE_LIST_CAT: { std::pair<mcmap::iterator, mcmap::iterator> range = mods2.equal_range( p_item->min.i ); std::string list = "_values -s , "; list = list.append( p_item->psz_name ); while( range.first != range.second ) { list = list.append( " '*" ); list = list.append( range.first->second ); list = list.append( "'" ); ++range.first; } asprintf( &psz_arguments, "%s", list.c_str() ); } break; case CONFIG_ITEM_STRING: if( p_item->i_list ) { int i = p_item->i_list -1; char *psz_list; if( p_item->ppsz_list_text ) asprintf( &psz_list, "%s\\:%s", p_item->ppsz_list[i], p_item->ppsz_list_text[i] ); else psz_list = strdup(p_item->ppsz_list[i]); char *psz_list2; while( i>1 ) { if( p_item->ppsz_list_text ) asprintf( &psz_list2, "%s\\:%s %s", p_item->ppsz_list[i-1], p_item->ppsz_list_text[i-1], psz_list ); else asprintf( &psz_list2, "%s %s", p_item->ppsz_list[i-1], psz_list ); free( psz_list ); psz_list = psz_list2; i--; } if( p_item->ppsz_list_text ) asprintf( &psz_arguments, "((%s))", psz_list ); else asprintf( &psz_arguments, "(%s)", psz_list ); free( psz_list ); } break; case CONFIG_ITEM_FILE: psz_arguments = strdup( "_files" ); break; case CONFIG_ITEM_DIRECTORY: psz_arguments = strdup( "_files -/" ); break; case CONFIG_ITEM_INTEGER: if( p_item->i_list ) { int i = p_item->i_list -1; char *psz_list; if( p_item->ppsz_list_text ) asprintf( &psz_list, "%d\\:%s", p_item->pi_list[i], p_item->ppsz_list_text[i] ); else psz_list = strdup(p_item->ppsz_list[i]); char *psz_list2; while( i>1 ) { if( p_item->ppsz_list_text ) asprintf( &psz_list2, "%d\\:%s %s", p_item->pi_list[i-1], p_item->ppsz_list_text[i-1], psz_list ); else asprintf( &psz_list2, "%s %s", p_item->ppsz_list[i-1], psz_list ); free( psz_list ); psz_list = psz_list2; i--; } if( p_item->ppsz_list_text ) asprintf( &psz_arguments, "((%s))", psz_list ); else asprintf( &psz_arguments, "(%s)", psz_list ); free( psz_list ); } else if( p_item->min.i != 0 || p_item->max.i != 0 ) {// p_control = new RangedIntConfigControl( p_this, p_item, parent ); } else {// p_control = new IntegerConfigControl( p_this, p_item, parent ); } break; case CONFIG_ITEM_KEY:// p_control = new KeyConfigControl( p_this, p_item, parent ); break; case CONFIG_ITEM_FLOAT:// p_control = new FloatConfigControl( p_this, p_item, parent ); break; case CONFIG_ITEM_BOOL:// p_control = new BoolConfigControl( p_this, p_item, parent ); psz_arguments = NULL; asprintf( &psz_exclusive, "--no%s --no-%s", p_item->psz_name, p_item->psz_name ); psz_name = DUP( p_item->psz_name ); psz_text = DUP( p_item->psz_text ); psz_longtext = DUP( p_item->psz_longtext ); PrintOption( psz_name, p_item->i_short, psz_exclusive, psz_text, psz_longtext, psz_arguments ); free( psz_name ); free( psz_text ); free( psz_longtext ); free( psz_exclusive ); asprintf( &psz_exclusive, "--no%s --%s", p_item->psz_name, p_item->psz_name ); asprintf( &psz_option, "no-%s", p_item->psz_name ); psz_text = DUP( p_item->psz_text ); psz_longtext = DUP( p_item->psz_longtext ); PrintOption( psz_option, p_item->i_short, psz_exclusive, psz_text, psz_longtext, psz_arguments ); free( psz_text ); free( psz_longtext ); free( psz_exclusive ); free( psz_option ); asprintf( &psz_exclusive, "--no-%s --%s", p_item->psz_name, p_item->psz_name ); asprintf( &psz_option, "no%s", p_item->psz_name ); psz_text = DUP( p_item->psz_text ); psz_longtext = DUP( p_item->psz_longtext ); PrintOption( psz_option, p_item->i_short, psz_exclusive, psz_text, psz_longtext, psz_arguments ); free( psz_text ); free( psz_longtext ); free( psz_exclusive ); free( psz_option ); return; case CONFIG_SECTION:// p_control = new SectionConfigControl( p_this, p_item, parent ); break; default: break; } psz_name = DUP( p_item->psz_name ); psz_text = DUP( p_item->psz_text ); psz_longtext = DUP( p_item->psz_longtext ); PrintOption( psz_name, p_item->i_short, NULL, psz_text, psz_longtext, psz_arguments ); free( psz_name ); free( psz_text ); free( psz_longtext );}void PrintOption( char *psz_option, char i_short, char *psz_exclusive, char *psz_text, char *psz_longtext, char *psz_args ){ char *foo; if( psz_text ) { while( (foo = strchr( psz_text, ':' ))) *foo=';'; while( (foo = strchr( psz_text, '"' ))) *foo='\''; } if( psz_longtext ) { while( (foo = strchr( psz_longtext, ':' ))) *foo=';'; while( (foo = strchr( psz_longtext, '"' ))) *foo='\''; } if( !psz_longtext || strchr( psz_longtext, '\n' ) || strchr( psz_longtext, '(' ) ) psz_longtext = psz_text; if( i_short ) { if( !psz_exclusive ) psz_exclusive = strdup( "" ); else asprintf( &psz_exclusive, " %s", psz_exclusive ); printf( " \"(-%c%s)--%s%s[%s]", i_short, psz_exclusive, psz_option, psz_args?"=":"", psz_text ); if( psz_args ) printf( ":%s:%s\"\\\n", psz_longtext, psz_args ); else printf( "\"\\\n" ); printf( " \"(--%s%s)-%c[%s]", psz_option, psz_exclusive, i_short, psz_text ); if( psz_args ) printf( ":%s:%s\"\\\n", psz_longtext, psz_args ); else printf( "\"\\\n" ); } else { if( psz_exclusive ) printf( " \"(%s)--%s%s[%s]", psz_exclusive, psz_option, psz_args?"=":"", psz_text ); else printf( " \"--%s[%s]", psz_option, psz_text ); if( psz_args ) printf( ":%s:%s\"\\\n", psz_longtext, psz_args ); else printf( "\"\\\n" ); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -