Minor bug fixes in the help of calypTools
This commit is contained in:
1 parent
f6cc0ffd29
commit
684cecd632
4 files changed
+35
-34
No files matched your search
@@ -38,13 +38,13 @@
|
||||
|
||||
#include "CalypOptions.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct ParseFailure : public std::exception
|
||||
@@ -284,7 +284,7 @@ bool CalypOptions::hasOpt( const ClpString& optName )
|
||||
void CalypOptions::addDefaultOptions()
|
||||
{
|
||||
addOptions() /**/
|
||||
( "help,h", "produce help message" ) /**/
|
||||
( "help", "produce help message" ) /**/
|
||||
( "version", "show version and exit" ) /**/
|
||||
( "pel_fmts", "list pixel formats" ) /**/
|
||||
( "quality_metrics", "list supported quality metrics" ) /**/
|
||||
@@ -477,27 +477,26 @@ unsigned int CalypOptions::parseSHORT( unsigned int argc, char* argv[] )
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool CalypOptions::parse( unsigned int argc, char* argv[] )
|
||||
int CalypOptions::parse( unsigned int argc, char* argv[] )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_aUnhandledArgs = scanArgv( argc, argv );
|
||||
|
||||
if( checkListingOpts() )
|
||||
{
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cerr << "error: " << e.what() << "\n";
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
std::cerr << "Exception of unknown type!\n";
|
||||
}
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
list<const char*> CalypOptions::scanArgv( unsigned int argc, char* argv[] )
|
||||
|
||||
+3
-3
@@ -40,11 +40,11 @@
|
||||
#ifndef __CALYPOPTIONS_H__
|
||||
#define __CALYPOPTIONS_H__
|
||||
|
||||
#include "CalypDefs.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include "CalypDefs.h"
|
||||
|
||||
/**
|
||||
* \class OptionBase
|
||||
* \ingroup CalypLibGrp
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
CalypOptions( const ClpString& name = "" );
|
||||
~CalypOptions();
|
||||
|
||||
bool parse( unsigned int argc, char* argv[] );
|
||||
int parse( unsigned int argc, char* argv[] );
|
||||
void parse( std::vector<ClpString> args_array );
|
||||
|
||||
std::list<const char*>& getUnhandledArgs() { return m_aUnhandledArgs; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Copyright (C) 2014-2020 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -421,8 +421,8 @@ int CalypTools::Open( int argc, char* argv[] )
|
||||
|
||||
if( m_uiOperation == INVALID_OPERATION )
|
||||
{
|
||||
log( CLP_LOG_ERROR, "No operation was selected! " );
|
||||
return -1;
|
||||
log( CLP_LOG_ERROR, "No operation was selected! Use --help to see usage.\n" );
|
||||
return 1;
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Copyright (C) 2014-202 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -59,23 +59,25 @@ int CalypToolsCmdParser::parseToolsArgs( int argc, char* argv[] )
|
||||
{
|
||||
int iRet = 0;
|
||||
|
||||
m_cOptions.addOptions() /**/
|
||||
( "quiet,q", m_bQuiet, "disable verbose" )( "input,i", m_apcInputs, "input file" ) /**/
|
||||
( "output,o", m_strOutput, "output file" ) /**/
|
||||
( "size,s", m_strResolution, "size (WxH)" ) /**/
|
||||
( "pel_fmt,p", m_strPelFmt, "pixel format" ) /**/
|
||||
( "bits_pel", m_strBitsPerPixel, "bits per pixel" ) /**/
|
||||
( "endianness", m_strEndianness, "File endianness (big, little)" ) /**/
|
||||
( "has_negative", m_strHasNegativeValues, "Flag for files with negatie values" ) /**/
|
||||
( "frames,f", m_iFrames, "number of frames to parse" ) /**/
|
||||
( "quality", m_strQualityMetric, "select a quality metric" ) /**/
|
||||
( "module", m_strModule, "select a module (use internal name)" ) /**/
|
||||
( "save", "save a specific frame" ) /**/
|
||||
( "rate-reduction", m_iRateReductionFactor, "reduce the frame rate" ); /**/
|
||||
m_cOptions.addOptions() /**/
|
||||
( "quiet,q", m_bQuiet, "disable verbose" ) /**/
|
||||
( "input,i", m_apcInputs, "input file" ) /**/
|
||||
( "output,o", m_strOutput, "output file" ) /**/
|
||||
( "size,s", m_strResolution, "size (WxH)" ) /**/
|
||||
( "pel_fmt,p", m_strPelFmt, "pixel format" ) /**/
|
||||
( "bits_pel", m_strBitsPerPixel, "bits per pixel" ) /**/
|
||||
( "endianness", m_strEndianness, "File endianness (big, little)" ) /**/
|
||||
( "has_negative", m_strHasNegativeValues, "Flag for files with negatie values" ) /**/
|
||||
( "frames,f", m_iFrames, "number of frames to parse" ) /**/
|
||||
( "quality", m_strQualityMetric, "select a quality metric" ) /**/
|
||||
( "module", m_strModule, "select a module (use internal name)" ) /**/
|
||||
( "save", "save a specific frame" ) /**/
|
||||
( "rate-reduction", m_iRateReductionFactor, "reduce the frame rate" ); /**/
|
||||
|
||||
if( !m_cOptions.parse( argc, argv ) )
|
||||
iRet = m_cOptions.parse( argc, argv );
|
||||
if( iRet < 0 || iRet > 0 )
|
||||
{
|
||||
iRet = -1;
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if( m_bQuiet )
|
||||
@@ -96,9 +98,9 @@ int CalypToolsCmdParser::parseToolsArgs( int argc, char* argv[] )
|
||||
}
|
||||
else if( m_cOptions.hasOpt( "help" ) )
|
||||
{
|
||||
printf( "Usage: %s modules/quality/save [options] -input=input_file "
|
||||
"[--output=output_file]\n",
|
||||
argv[0] );
|
||||
printf( "Usage: %s module/quality/save [options] --input=input_file [--output=output_file]\n", argv[0] );
|
||||
printf( " %s --module=module_name [options] --input=input_file [--output=output_file]\n", argv[0] );
|
||||
printf( " %s --quality=quality_metric [options] --input=input_file1 --input=input_file2\n", argv[0] );
|
||||
m_cOptions.doHelp( std::cout );
|
||||
iRet = 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user