Merge pull request #8247 from Mailaender/man-openra

Added a UNIX man page
This commit is contained in:
abcdefg30
2015-08-01 12:06:14 +02:00
9 changed files with 169 additions and 27 deletions

1
.gitignore vendored
View File

@@ -62,6 +62,7 @@ OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.mode1v3
DOCUMENTATION.md
Lua-API.md
*.html
openra.6
# StyleCop
*.Cache

View File

@@ -58,6 +58,7 @@ endif
prefix ?= /usr/local
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
mandir ?= $(datarootdir)/man/
bindir ?= $(prefix)/bin
libdir ?= $(prefix)/lib
gameinstalldir ?= $(libdir)/openra
@@ -320,6 +321,9 @@ docs: utility mods version
@mono --debug OpenRA.Utility.exe all --docs > DOCUMENTATION.md
@mono --debug OpenRA.Utility.exe ra --lua-docs > Lua-API.md
man-page: utility mods
@mono --debug OpenRA.Utility.exe all --man-page > openra.6
install: install-core
install-all: install-core install-tools
@@ -389,6 +393,10 @@ install-linux-appdata:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/appdata/"
@$(INSTALL_DATA) packaging/linux/openra.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
install-man-page: man-page
@$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man6/"
@$(INSTALL_DATA) openra.6 "$(DESTDIR)$(mandir)/man6/"
install-linux-scripts:
@echo "#!/bin/sh" > openra
@echo 'cd "$(gameinstalldir)"' >> openra
@@ -419,6 +427,7 @@ uninstall:
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/128x128/apps/openra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/mime/packages/openra.xml"
@-$(RM_F) "$(DESTDIR)$(datadir)/appdata/openra.appdata.xml"
@-$(RM_F) "$(DESTDIR)$(mandir)/man6/openra.6"
help:
@echo to compile, run:

View File

@@ -164,6 +164,7 @@
<Compile Include="Server\ServerOrder.cs" />
<Compile Include="Server\TraitInterfaces.cs" />
<Compile Include="Support\Arguments.cs" />
<Compile Include="Support\LaunchArguments.cs" />
<Compile Include="Support\PerfHistory.cs" />
<Compile Include="Support\Program.cs" />
<Compile Include="Sync.cs" />

View File

@@ -23,24 +23,55 @@ namespace OpenRA
public class ServerSettings
{
[Desc("Sets the server name.")]
public string Name = "OpenRA Game";
[Desc("Sets the internal port.")]
public int ListenPort = 1234;
[Desc("Sets the port advertised to the master server.")]
public int ExternalPort = 1234;
[Desc("Reports the game to the master server list.")]
public bool AdvertiseOnline = true;
[Desc("Locks the game with a password.")]
public string Password = "";
public string MasterServer = "http://master.openra.net/";
public bool DiscoverNatDevices = false; // Allow users to disable NAT discovery if problems occur
public bool AllowPortForward = true; // let the user disable it even if compatible devices are found
[Desc("Allow users to enable NAT discovery for external IP detection and automatic port forwarding.")]
public bool DiscoverNatDevices = false;
[Desc("Set this to false to disable UPnP even if compatible devices are found.")]
public bool AllowPortForward = true;
public bool NatDeviceAvailable = false; // internal check if discovery succeeded
public int NatDiscoveryTimeout = 1000; // ms to search for UPnP enabled NATs
public bool VerboseNatDiscovery = false; // print very detailed logs for debugging
[Desc("Time in miliseconds to search for UPnP enabled NAT devices.")]
public int NatDiscoveryTimeout = 1000;
[Desc("Print very detailed logs for debugging issues with routers.")]
public bool VerboseNatDiscovery = false;
[Desc("Starts the game with a default map. Input as hash that can be obtained by the utility.")]
public string Map = null;
[Desc("Takes a comma separated list of IP addresses that are not allowed to join.")]
public string[] Ban = { };
[Desc("Value in miliseconds when to terminate the game. Needs to be at least 10000 (10 s) to enable the timer.")]
public int TimeOut = 0;
[Desc("Run in headless mode with an empty renderer and without sound output.")]
public bool Dedicated = false;
[Desc("Automatically restart when a game ends. Disable this when something else already takes care about it.")]
public bool DedicatedLoop = true;
[Desc("Disallow AI bots.")]
public bool LockBots = false;
public bool AllowVersionMismatch = false;
public string TimestampFormat = "HH:mm";
public ServerSettings() { }
@@ -64,7 +95,6 @@ namespace OpenRA
Dedicated = other.Dedicated;
DedicatedLoop = other.DedicatedLoop;
LockBots = other.LockBots;
AllowVersionMismatch = other.AllowVersionMismatch;
}
}
@@ -124,6 +154,7 @@ namespace OpenRA
public class GameSettings
{
[Desc("Load a specific mod on startup. Shipped ones include: ra, cnc and d2k")]
public string Mod = "modchooser";
public string PreviousMod = "ra";

View File

@@ -0,0 +1,44 @@
#region Copyright & License Information
/*
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
namespace OpenRA
{
public class LaunchArguments
{
[Desc("Connect to the following server given as IP:PORT on startup.")]
public string Connect;
[Desc("Connect to the unified resource identifier openra://IP:PORT on startup.")]
public string URI;
[Desc("Automatically start playing the given replay file.")]
public string Replay;
public LaunchArguments(Arguments args)
{
foreach (var f in this.GetType().GetFields())
if (args.Contains("Launch" + "." + f.Name))
FieldLoader.LoadField(this, f.Name, args.GetValue("Launch" + "." + f.Name, ""));
}
public string GetConnectAddress()
{
var connect = string.Empty;
if (!string.IsNullOrEmpty(Connect))
connect = Connect;
if (!string.IsNullOrEmpty(URI))
connect = URI.Replace("openra://", "").TrimEnd('/');
return connect;
}
}
}

View File

@@ -20,6 +20,8 @@ namespace OpenRA.Mods.Common.LoadScreens
{
public class BlankLoadScreen : ILoadScreen
{
public LaunchArguments Launch;
public virtual void Init(Manifest m, Dictionary<string, string> info) { }
public virtual void Display()
@@ -34,6 +36,7 @@ namespace OpenRA.Mods.Common.LoadScreens
public void StartGame(Arguments args)
{
Launch = new LaunchArguments(args);
Ui.ResetAll();
Game.Settings.Save();
@@ -62,23 +65,7 @@ namespace OpenRA.Mods.Common.LoadScreens
}
// Join a server directly
var connect = string.Empty;
if (args != null)
{
if (args.Contains("Launch.Connect"))
connect = args.GetValue("Launch.Connect", null);
if (args.Contains("Launch.URI"))
{
connect = args.GetValue("Launch.URI", null);
if (connect != null)
{
connect = connect.Replace("openra://", "");
connect = connect.TrimEnd('/');
}
}
}
var connect = Launch.GetConnectAddress();
if (!string.IsNullOrEmpty(connect))
{
var parts = connect.Split(':');
@@ -94,12 +81,11 @@ namespace OpenRA.Mods.Common.LoadScreens
}
// Load a replay directly
var replayFilename = args != null ? args.GetValue("Launch.Replay", null) : null;
if (!string.IsNullOrEmpty(replayFilename))
if (!string.IsNullOrEmpty(Launch.Replay))
{
var replayMeta = ReplayMetadata.Read(replayFilename);
var replayMeta = ReplayMetadata.Read(Launch.Replay);
if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
Game.JoinReplay(replayFilename);
Game.JoinReplay(Launch.Replay);
if (replayMeta != null)
{

View File

@@ -529,6 +529,7 @@
<Compile Include="UtilityCommands\CheckCodeStyle.cs" />
<Compile Include="UtilityCommands\ConvertPngToShpCommand.cs" />
<Compile Include="UtilityCommands\ConvertSpriteToPngCommand.cs" />
<Compile Include="UtilityCommands\CreateManPage.cs" />
<Compile Include="UtilityCommands\ExportCharacterSeparatedRules.cs" />
<Compile Include="UtilityCommands\Extensions.cs" />
<Compile Include="UtilityCommands\ExtractFilesCommand.cs" />

View File

@@ -0,0 +1,68 @@
#region Copyright & License Information
/*
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Linq;
namespace OpenRA.Mods.Common.UtilityCommands
{
class CreateManPage : IUtilityCommand
{
public string Name { get { return "--man-page"; } }
[Desc("Create a man page in troff format.")]
public void Run(ModData modData, string[] args)
{
Console.WriteLine(".TH OPENRA 6");
Console.WriteLine(".SH NAME");
Console.WriteLine("openra \\- An Open Source modernization of the early 2D Command & Conquer games.");
Console.WriteLine(".SH SYNOPSIS");
Console.WriteLine(".B openra");
Console.WriteLine("[\\fB\\Game.Mod=\\fR\\fImodchooser\\fR]");
Console.WriteLine(".SH DESCRIPTION");
Console.WriteLine(".B openra");
Console.WriteLine("starts the game.");
Console.WriteLine(".SH OPTIONS");
var sections = Game.Settings.Sections;
sections.Add("Launch", new LaunchArguments(new Arguments(new string[0])));
foreach (var section in sections.OrderBy(s => s.Key))
{
var fields = section.Value.GetType().GetFields();
foreach (var field in fields)
{
if (!field.HasAttribute<DescAttribute>())
continue;
Console.WriteLine(".TP");
Console.Write(".BR {0}.{1}=".F(section.Key, field.Name));
var value = field.GetValue(section.Value);
if (value != null && !value.ToString().StartsWith("System."))
Console.WriteLine("\\fI{0}\\fR".F(value));
else
Console.WriteLine();
var lines = field.GetCustomAttributes<DescAttribute>(false).SelectMany(d => d.Lines);
foreach (var line in lines)
Console.WriteLine(line);
}
}
Console.WriteLine(".SH FILES");
Console.WriteLine("Settings are stored in the ~/.openra user folder.");
Console.WriteLine(".SH BUGS");
Console.WriteLine("Known issues are tracked at http://bugs.openra.net");
Console.WriteLine(".SH COPYRIGHT");
Console.WriteLine("Copyright 2007-2015 The OpenRA Developers (see AUTHORS)");
Console.WriteLine("This manual is part of OpenRA, which is free software. It is GNU GPL v3 licensed. See COPYING for details.");
}
}
}

View File

@@ -24,6 +24,7 @@ make install-all prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-linux-shortcuts prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-linux-mime prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-linux-appdata prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-man-page prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
# Documentation
mkdir -p $PWD/packaging/linux/$ROOTDIR/usr/share/doc/openra/