Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
Seblu
installsystems
Commits
ce07794a
Commit
ce07794a
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
add --no-color option to is
This allow displaying to be done without coloration
parent
48d0f32d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/is
+6
-0
6 additions, 0 deletions
bin/is
installsystems/printer.py
+7
-5
7 additions, 5 deletions
installsystems/printer.py
samples/installsystems.conf
+3
-0
3 additions, 0 deletions
samples/installsystems.conf
with
16 additions
and
5 deletions
bin/is
+
6
−
0
View file @
ce07794a
...
...
@@ -14,6 +14,7 @@ import re
import
fnmatch
import
warnings
import
installsystems
import
installsystems.printer
import
installsystems.tools
as
istools
import
installsystems.argparse
as
argparse
# to be removed when python2.7
from
installsystems.printer
import
*
...
...
@@ -318,6 +319,8 @@ p_main.add_argument("-C", "--cache", default=None,
help
=
"
path of the repository cache
"
)
p_main
.
add_argument
(
"
--no-cache
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
not use persistent db caching
"
)
p_main
.
add_argument
(
"
--no-color
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
dot not display colored output
"
)
p_main
.
add_argument
(
"
-t
"
,
"
--timeout
"
,
dest
=
"
timeout
"
,
type
=
int
,
default
=
3
,
help
=
"
download timeout (default 3)
"
)
...
...
@@ -499,6 +502,9 @@ try:
# no warning if we are not in debug mode
if
not
installsystems
.
debug
:
warnings
.
filterwarnings
(
"
ignore
"
)
# disable coloring if asked
if
args
.
no_color
:
installsystems
.
printer
.
NOCOLOR
=
True
# except for install command we parse all args!
if
args
.
func
is
not
c_install
:
args
=
p_main
.
parse_args
(
namespace
=
args
)
...
...
This diff is collapsed.
Click to expand it.
installsystems/printer.py
+
7
−
5
View file @
ce07794a
...
...
@@ -10,7 +10,9 @@ import sys
import
os
import
installsystems
color
=
{
NOCOLOR
=
False
COLOR
=
{
# regular
"
black
"
:
"
\033
[30m
"
,
"
B
"
:
"
\033
[30m
"
,
...
...
@@ -46,11 +48,11 @@ def out(message="", fd=sys.stdout, endl=os.linesep, flush=True):
Print message colorised in fd ended by endl
'''
# color subsitution
for
c
in
color
:
if
fd
.
isatty
():
message
=
message
.
replace
(
"
#%s#
"
%
c
,
color
[
c
])
else
:
for
c
in
COLOR
:
if
not
fd
.
isatty
()
or
NOCOLOR
:
message
=
message
.
replace
(
"
#%s#
"
%
c
,
""
)
else
:
message
=
message
.
replace
(
"
#%s#
"
%
c
,
COLOR
[
c
])
# convert unicode into str before write
# this can cause issue on python 2.6
if
type
(
message
)
==
unicode
:
...
...
This diff is collapsed.
Click to expand it.
samples/installsystems.conf
+
3
−
0
View file @
ce07794a
...
...
@@ -14,6 +14,9 @@
# disable cache of remote repository
#no_cache = 1
# disable output coloring
#no_color = 1
# disable check of script during build
#no_check = 1
...
...
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