mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Add support for bold mode to set_color command
darcs-hash:20050924012834-ac50b-c531500a7fa2b720909ea72d48bc39a74f5026b5.gz
This commit is contained in:
parent
935602bd72
commit
3e0e50fbf3
2 changed files with 20 additions and 4 deletions
|
@ -11,6 +11,7 @@ COLOR is one of black, red, green, brown, yellow, blue, magenta,
|
|||
purple, cyan, white and normal.
|
||||
|
||||
- \c -b, \c --background Set the background color
|
||||
- \c -o, \c --bold Set bold or extra bright mode
|
||||
- \c -h, \c --help Display help message and exit
|
||||
- \c -v, \c --version Display version and exit
|
||||
|
||||
|
|
23
set_color.c
23
set_color.c
|
@ -101,6 +101,7 @@ int main( int argc, char **argv )
|
|||
char *bgcolor=0;
|
||||
char *fgcolor=0;
|
||||
int fg, bg;
|
||||
int bold=0;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
|
@ -116,6 +117,10 @@ int main( int argc, char **argv )
|
|||
"help", no_argument, 0, 'h'
|
||||
}
|
||||
,
|
||||
{
|
||||
"bold", no_argument, 0, 'o'
|
||||
}
|
||||
,
|
||||
{
|
||||
"version", no_argument, 0, 'v'
|
||||
}
|
||||
|
@ -130,13 +135,13 @@ int main( int argc, char **argv )
|
|||
|
||||
int opt = getopt_long( argc,
|
||||
argv,
|
||||
"b:hv",
|
||||
"b:hvo",
|
||||
long_options,
|
||||
&opt_index );
|
||||
#else
|
||||
int opt = getopt( argc,
|
||||
argv,
|
||||
"b:hv" );
|
||||
"b:hvo" );
|
||||
#endif
|
||||
if( opt == -1 )
|
||||
break;
|
||||
|
@ -153,6 +158,10 @@ int main( int argc, char **argv )
|
|||
print_help();
|
||||
exit(0);
|
||||
|
||||
case 'o':
|
||||
bold=1;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
fprintf( stderr, "set_color, version %s\n", PACKAGE_VERSION );
|
||||
exit( 0 );
|
||||
|
@ -180,13 +189,13 @@ int main( int argc, char **argv )
|
|||
return 1;
|
||||
}
|
||||
|
||||
if( !fgcolor && !bgcolor )
|
||||
if( !fgcolor && !bgcolor && !bold )
|
||||
{
|
||||
fprintf( stderr, "set_color: Expected an argument\n" );
|
||||
print_help();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
fg = translate_color(fgcolor);
|
||||
if( fgcolor && (fg==-1))
|
||||
{
|
||||
|
@ -202,6 +211,12 @@ int main( int argc, char **argv )
|
|||
}
|
||||
|
||||
setupterm( 0, STDOUT_FILENO, 0);
|
||||
|
||||
if( bold )
|
||||
{
|
||||
putp( enter_bold_mode );
|
||||
}
|
||||
|
||||
if( bgcolor )
|
||||
{
|
||||
if( bg == 8 )
|
||||
|
|
Loading…
Reference in a new issue