Skip to content

Access version number from terminal #1064

Closed

Description

@FriedrichFroebel

Details for the issue

It may be helpful to have a command line option (or default info text when using the --help argument) to print the version number.

Useful extra information

I'm opening this issue because:

  • DB4S is crashing
  • DB4S has a bug
  • [ X ] DB4S needs a feature
  • DB4S has another problem

I'm using DB4S on:

  • Windows: ( version: ___ )
  • [ X ] Linux: ( distro: Ubuntu 16.04 )
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using DB4S version:

  • [ X ] 3.9.1
  • 3.9.0
  • Other: ___

I have also:

Activity

  1. justinclift commented on Jul 27, 2017

    @justinclift
    Member

    Good thinking @FriedrichFroebel. 😄

    At a quick look, it'll probably need to be added here and doesn't look too difficult:

       

    // Parse command line
    QString fileToOpen;
    QString tableToBrowse;
    QStringList sqlToExecute;
    m_dontShowMainWindow = false;
    for(int i=1;i<arguments().size();i++)
    {
    // Check next command line argument
    if(arguments().at(i) == "-h" || arguments().at(i) == "--help")
    {
    // Help
    qWarning() << qPrintable(tr("Usage: %1 [options] [db]\n").arg(argv[0]));
    qWarning() << qPrintable(tr("Possible command line arguments:"));
    qWarning() << qPrintable(tr(" -h, --help\t\tShow command line options"));
    qWarning() << qPrintable(tr(" -s, --sql [file]\tExecute this SQL file after opening the DB"));
    qWarning() << qPrintable(tr(" -t, --table [table]\tBrowse this table after opening the DB"));
    qWarning() << qPrintable(tr(" -q, --quit\t\tExit application after running scripts"));
    qWarning() << qPrintable(tr(" [file]\t\tOpen this SQLite database"));
    m_dontShowMainWindow = true;
    } else if(arguments().at(i) == "-s" || arguments().at(i) == "--sql") {
    // Run SQL file: If file exists add it to list of scripts to execute
    if(++i >= arguments().size())
    qWarning() << qPrintable(tr("The -s/--sql option requires an argument"));
    else if(!QFile::exists(arguments().at(i)))
    qWarning() << qPrintable(tr("The file %1 does not exist").arg(arguments().at(i)));
    else
    sqlToExecute.append(arguments().at(i));
    } else if(arguments().at(i) == "-t" || arguments().at(i) == "--table") {
    if(++i >= arguments().size())
    qWarning() << qPrintable(tr("The -t/--table option requires an argument"));
    else
    tableToBrowse = arguments().at(i);
    } else if(arguments().at(i) == "-q" || arguments().at(i) == "--quit") {
    m_dontShowMainWindow = true;
    } else {
    // Other: Check if it's a valid file name
    if(QFile::exists(arguments().at(i)))
    fileToOpen = arguments().at(i);
    else
    qWarning() << qPrintable(tr("Invalid option/non-existant file: %1").arg(arguments().at(i)));
    }
    }

  2. FriedrichFroebel commented on Jul 29, 2017

    @FriedrichFroebel
    ContributorAuthor

    Seems like this issue can be closed after commit 441a08a.

  3. justinclift commented on Jul 29, 2017

    @justinclift
    Member

    Ooops, yep. I forgot to close this the other day, thanks. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions