Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chump] add --query:[version_language|version_chugin_api] command-line args #440

Merged
merged 2 commits into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion src/host/chuck_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ t_CKBOOL global_cleanup();
void all_stop();
void all_detach();
void usage();
void usage_query();
void uh();
t_CKBOOL get_count( const char * arg, t_CKUINT * out );
static void audio_cb( SAMPLE * in, SAMPLE * out, t_CKUINT numFrames,
Expand Down Expand Up @@ -247,7 +248,7 @@ static void version()

//-----------------------------------------------------------------------------
// name: usage()
// desc: ...
// desc: print command line options
//-----------------------------------------------------------------------------
void usage()
{
Expand All @@ -262,6 +263,7 @@ void usage()
CK_FPRINTF_STDERR( " callback|deprecate:{stop|warn|ignore}|chugin-probe\n" );
CK_FPRINTF_STDERR( " chugin-load:{on|off}|chugin-path:<path>|chugin:<name>\n" );
CK_FPRINTF_STDERR( " color:{on|off}|pid-file:<path>|cmd-listener:{on|off}\n" );
CK_FPRINTF_STDERR( " query|query:<name>\n" );
CK_FPRINTF_STDERR( "%s", TC::set_blue().c_str() );
CK_FPRINTF_STDERR( " [commands] = add|replace|remove|remove.all|status|time|\n" );
CK_FPRINTF_STDERR( " clear.vm|reset.id|abort.shred|exit\n" );
Expand All @@ -272,6 +274,21 @@ void usage()



//-----------------------------------------------------------------------------
// name: usage_query() | added 1.5.2.5 (nshaheed, ge)
// desc: print command line options for --query:<name>
//-----------------------------------------------------------------------------
void usage_query()
{
CK_FPRINTF_STDERR( "possible names for --query:<name>: \n" );
CK_FPRINTF_STDERR( " VERSION_LANGUAGE : language version (e.g., 1.5.2.0 (chai))\n" );
CK_FPRINTF_STDERR( " VERSION_CHUGIN_API : chugin API version (e.g., 10.1)\n" );
CK_FPRINTF_STDERR( " VERSION : (same as VERSION_LANGUAGE)\n" );
}




// non-NULL when a pid file has been written
const char * g_ck_pidfile = NULL;
// current process id
Expand Down Expand Up @@ -979,6 +996,38 @@ t_CKBOOL go( int argc, const char ** argv )
{
doVersion = TRUE;
}
else if( !strncmp( argv[i], "--query:", 8 ) ) // added 1.5.2.5 (nshaheed)
{
// advance pointer to beginning of argument
string str = ::tolower(argv[i]+8);

// check <name>
if( str == "version_language" || str == "version" )
{
CK_FPRINTF_STDOUT( "%s\n", CHUCK_VERSION_STRING );
}
else if( str == "version_chugin_api" )
{
CK_FPRINTF_STDOUT( "%d.%d\n", CK_DLL_VERSION_MAJOR, CK_DLL_VERSION_MINOR );
}
else // no match
{
// print error
EM_error2( 0, "invalid argument '%s' for '--query:<name>'", str.c_str() );
// print --query usage
usage_query();
}

// clean up and exit
EXIT_with_global_cleanup( 0 );
}
else if( !strncmp( argv[i], "--query", 7 ) ) // added 1.5.2.5 (nshaheed)
{
// print --query:<name> usage
usage_query();
// clean up and exit
EXIT_with_global_cleanup( 0 );
}
else
{
// boost log level
Expand Down
Loading