@@ -130,6 +130,26 @@ int bandageImage(QStringList arguments)
130130 g_settings->startingNodes ,
131131 " all" );
132132
133+ QString errormsg;
134+ QStringList columns;
135+ bool coloursLoaded = false ;
136+ QString csvPath = parseColorsOption (arguments);
137+ if (csvPath != " " )
138+ {
139+ if (!g_assemblyGraph->loadCSV (csvPath, &columns, &errormsg, &coloursLoaded))
140+ {
141+ err << errormsg << endl;
142+ return 1 ;
143+ }
144+
145+ if (coloursLoaded == false )
146+ {
147+ err << csvPath << " didn't contains color" << endl;
148+ return 1 ;
149+ }
150+ g_settings->nodeColourScheme = CUSTOM_COLOURS;
151+ }
152+
133153 if (errorMessage != " " )
134154 {
135155 err << errorMessage << endl;
@@ -212,6 +232,7 @@ void printImageUsage(QTextStream * out, bool all)
212232 text << " " ;
213233 text << " Options: --height <int> Image height (default: 1000)" ;
214234 text << " --width <int> Image width (default: not set)" ;
235+ text << " --color <file> csv file with 2 column first the node name second the node color" ;
215236 text << " " ;
216237 text << " If only height or width is set, the other will be determined automatically. If both are set, the image will be exactly that size." ;
217238 text << " " ;
@@ -232,6 +253,9 @@ QString checkForInvalidImageOptions(QStringList arguments)
232253 error = checkOptionForInt (" --width" , &arguments, IntSetting (0 , 1 , 32767 ), false );
233254 if (error.length () > 0 ) return error;
234255
256+ error = checkOptionForString (" --colors" , &arguments, QStringList (), " a path of csv file" );
257+ if (error.length () > 0 ) return error;
258+
235259 return checkForInvalidOrExcessSettings (&arguments);
236260}
237261
@@ -251,3 +275,15 @@ void parseImageOptions(QStringList arguments, int * width, int * height)
251275 parseSettings (arguments);
252276}
253277
278+ // This function parses the command line options. It assumes that the options
279+ // have already been checked for correctness.
280+ QString parseColorsOption (QStringList arguments)
281+ {
282+ QString path = " " ;
283+ if (isOptionPresent (" --colors" , &arguments))
284+ path = getStringOption (" --colors" , &arguments);
285+
286+ parseSettings (arguments);
287+
288+ return path;
289+ }
0 commit comments