Changeset 4259 in josm for trunk


Ignore:
Timestamp:
2011-07-20T16:04:43+02:00 (13 years ago)
Author:
bastiK
Message:

see #5906 - start option --version

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r4237 r4259  
    6666
    6767    private int version;
    68     private String revision;
     68    private String releaseDescription;
    6969    private String time;
    7070    private boolean isLocalBuild;
     
    9696    protected void initFromRevisionInfo(String revisionInfo) {
    9797        if (revisionInfo == null) {
    98             this.revision = tr("UNKNOWN");
     98            this.releaseDescription = tr("UNKNOWN");
    9999            this.version = JOSM_UNKNOWN_VERSION;
    100100            this.time = null;
     
    137137            sb.append(property.getKey()).append(":").append(property.getValue()).append("\n");
    138138        }
    139         revision = sb.toString();
     139        releaseDescription = sb.toString();
    140140    }
    141141
     
    145145            System.err.println(tr("Warning: the revision file ''/REVISION'' is missing."));
    146146            version = 0;
    147             revision = "";
     147            releaseDescription = "";
    148148            return;
    149149        }
    150150        initFromRevisionInfo(loadResourceFile(u));
    151         System.out.println(revision);
    152151    }
    153152
     
    168167     */
    169168    public String getReleaseAttributes() {
    170         return revision;
     169        return releaseDescription;
    171170    }
    172171
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r4249 r4259  
    2929import org.openstreetmap.josm.data.AutosaveTask;
    3030import org.openstreetmap.josm.data.Preferences;
     31import org.openstreetmap.josm.data.Version;
    3132import org.openstreetmap.josm.gui.preferences.server.OAuthAccessTokenHolder;
    3233import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    122123            if ("-h".equals(arg) || "-?".equals(arg)) {
    123124                arg = "--help";
     125            } else if ("-v".equals(arg)) {
     126                arg = "--version";
    124127            }
    125128            // handle simple arguments like file names, URLs, bounds
     
    172175        // initialize the platform hook, and
    173176        Main.determinePlatformHook();
    174         // call the really early hook before we anything else
     177        // call the really early hook before we do anything else
    175178        Main.platform.preStartupHook();
    176179
    177180        // construct argument table
    178181        final Map<String, Collection<String>> args = buildCommandLineArgumentMap(argArray);
     182
     183        if (args.containsKey("version")) {
     184            System.out.println(Version.getInstance().getAgentString());
     185            System.exit(0);
     186        } else {
     187            System.out.println(Version.getInstance().getReleaseAttributes());
     188        }
    179189
    180190        Main.pref.init(args.containsKey("reset-preferences"));
Note: See TracChangeset for help on using the changeset viewer.