-
-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2fdfc5
commit e0e23ee
Showing
8 changed files
with
224 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<?xml version='1.0'?> <!--*-nxml-*--> | ||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | ||
"http:https://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | ||
|
||
<refentry id="xdg-app-make-app-current"> | ||
|
||
<refentryinfo> | ||
<title>xdg-app make-app-current</title> | ||
<productname>xdg-app</productname> | ||
|
||
<authorgroup> | ||
<author> | ||
<contrib>Developer</contrib> | ||
<firstname>Alexander</firstname> | ||
<surname>Larsson</surname> | ||
<email>[email protected]</email> | ||
</author> | ||
</authorgroup> | ||
</refentryinfo> | ||
|
||
<refmeta> | ||
<refentrytitle>xdg-app make-app-current</refentrytitle> | ||
<manvolnum>1</manvolnum> | ||
</refmeta> | ||
|
||
<refnamediv> | ||
<refname>xdg-app-make-app-current</refname> | ||
<refpurpose>Make a specific version of an app current</refpurpose> | ||
</refnamediv> | ||
|
||
<refsynopsisdiv> | ||
<cmdsynopsis> | ||
<command>xdg-app make-app-current</command> | ||
<arg choice="opt" rep="repeat">OPTION</arg> | ||
<arg choice="plain">APP</arg> | ||
<arg choice="plain">BRANCH</arg> | ||
</cmdsynopsis> | ||
</refsynopsisdiv> | ||
|
||
<refsect1> | ||
<title>Description</title> | ||
|
||
<para> | ||
Makes a particular branch of an application current. Only the current branch | ||
of an app has its exported files (such as desktop files and icons) made visible | ||
to the host. | ||
</para> | ||
<para> | ||
When a new branch is installed it will automatically be made current, so this | ||
command is often not needed. | ||
</para> | ||
<para> | ||
Unless overridden with the --user option, this command creates a | ||
system-wide installation. | ||
</para> | ||
|
||
</refsect1> | ||
|
||
<refsect1> | ||
<title>Options</title> | ||
|
||
<para>The following options are understood:</para> | ||
|
||
<variablelist> | ||
<varlistentry> | ||
<term><option>-h</option></term> | ||
<term><option>--help</option></term> | ||
|
||
<listitem><para> | ||
Show help options and exit. | ||
</para></listitem> | ||
</varlistentry> | ||
|
||
<varlistentry> | ||
<term><option>--user</option></term> | ||
|
||
<listitem><para> | ||
Create a per-user installation. | ||
</para></listitem> | ||
</varlistentry> | ||
|
||
<varlistentry> | ||
<term><option>--system</option></term> | ||
|
||
<listitem><para> | ||
Create a system-wide installation. | ||
</para></listitem> | ||
</varlistentry> | ||
|
||
<varlistentry> | ||
<term><option>--arch=ARCH</option></term> | ||
|
||
<listitem><para> | ||
The architecture to install for. | ||
</para></listitem> | ||
</varlistentry> | ||
|
||
<varlistentry> | ||
<term><option>-v</option></term> | ||
<term><option>--verbose</option></term> | ||
|
||
<listitem><para> | ||
Print debug information during command processing. | ||
</para></listitem> | ||
</varlistentry> | ||
|
||
<varlistentry> | ||
<term><option>--version</option></term> | ||
|
||
<listitem><para> | ||
Print version information and exit. | ||
</para></listitem> | ||
</varlistentry> | ||
</variablelist> | ||
</refsect1> | ||
|
||
<refsect1> | ||
<title>Examples</title> | ||
|
||
<para> | ||
<command>$ xdg-app --user make-app-current org.gnome.GEdit 3.14</command> | ||
</para> | ||
|
||
</refsect1> | ||
|
||
<refsect1> | ||
<title>See also</title> | ||
|
||
<para> | ||
<citerefentry><refentrytitle>xdg-app</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | ||
<citerefentry><refentrytitle>xdg-app-install-app</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | ||
<citerefentry><refentrytitle>xdg-app-list-apps</refentrytitle><manvolnum>1</manvolnum></citerefentry> | ||
</para> | ||
|
||
</refsect1> | ||
|
||
</refentry> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include "config.h" | ||
|
||
#include <locale.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
#include <string.h> | ||
|
||
#include "libgsystem.h" | ||
|
||
#include "xdg-app-builtins.h" | ||
#include "xdg-app-utils.h" | ||
|
||
static char *opt_arch; | ||
|
||
static GOptionEntry options[] = { | ||
{ "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Arch to make current for", "ARCH" }, | ||
{ NULL } | ||
}; | ||
|
||
gboolean | ||
xdg_app_builtin_make_current_app (int argc, char **argv, GCancellable *cancellable, GError **error) | ||
{ | ||
gboolean ret = FALSE; | ||
GOptionContext *context; | ||
gs_unref_object XdgAppDir *dir = NULL; | ||
gs_unref_object GFile *deploy_base = NULL; | ||
gs_unref_object GFile *origin = NULL; | ||
const char *app; | ||
const char *branch = "master"; | ||
gs_free char *ref = NULL; | ||
|
||
context = g_option_context_new ("APP BRANCH - Make branch of application current"); | ||
|
||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error)) | ||
goto out; | ||
|
||
if (argc < 3) | ||
{ | ||
usage_error (context, "APP and BRANCH must be specified", error); | ||
goto out; | ||
} | ||
|
||
app = argv[1]; | ||
branch = argv[2]; | ||
|
||
if (!xdg_app_is_valid_name (app)) | ||
{ | ||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "'%s' is not a valid application name", app); | ||
goto out; | ||
} | ||
|
||
if (!xdg_app_is_valid_branch (branch)) | ||
{ | ||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "'%s' is not a valid branch name", branch); | ||
goto out; | ||
} | ||
|
||
ref = xdg_app_build_app_ref (app, branch, opt_arch); | ||
|
||
deploy_base = xdg_app_dir_get_deploy_dir (dir, ref); | ||
if (!g_file_query_exists (deploy_base, cancellable)) | ||
{ | ||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "App %s branch %s is not installed", app, branch); | ||
goto out; | ||
} | ||
|
||
if (!xdg_app_dir_make_current_ref (dir, ref, cancellable, error)) | ||
goto out; | ||
|
||
ret = TRUE; | ||
|
||
out: | ||
if (context) | ||
g_option_context_free (context); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters