File: pkgc-util.h

package info (click to toggle)
packagekit 1.3.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,824 kB
  • sloc: ansic: 56,491; cpp: 15,652; xml: 5,532; python: 4,932; sh: 316; perl: 60; makefile: 56
file content (92 lines) | stat: -rw-r--r-- 3,228 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2012-2025 Matthias Klumpp <matthias@tenstral.net>
 * Copyright (C) 2007-2014 Richard Hughes <richard@hughsie.com>
 *
 * Licensed under the GNU General Public License Version 2
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the license, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <glib.h>
#include <jansson.h>

#include "pkgc-context.h"

G_BEGIN_DECLS

/**
 * PkgcColor:
 *
 * Terminal color codes.
 */
typedef enum {
	PKGC_COLOR_RESET,
	PKGC_COLOR_BOLD,
	PKGC_COLOR_RED,
	PKGC_COLOR_GREEN,
	PKGC_COLOR_YELLOW,
	PKGC_COLOR_BLUE,
	PKGC_COLOR_MAGENTA,
	PKGC_COLOR_CYAN,
	PKGC_COLOR_GRAY
} PkgcColor;

gboolean		pkgc_util_setup_proxy (PkgcliContext *ctx, GError **error);
gboolean		pkgc_util_check_connection (PkgcliContext *ctx, GError **error);
gchar			*pkgc_util_format_size (guint64 size);
gchar			*pkgc_util_format_time (guint seconds);

void			pkgc_print_json_decref (json_t *root);

const gchar		*pkgc_get_ansi_color (PkgcliContext *ctx, PkgcColor color);

void			pkgc_print_package (PkgcliContext *ctx, PkPackage *package);
void			pkgc_print_package_detail (PkgcliContext *ctx, PkDetails *details);
void			pkgc_print_update_detail (PkgcliContext *ctx, PkUpdateDetail *update);
void			pkgc_print_repo (PkgcliContext *ctx, PkRepoDetail *repo);
void			pkgc_print_transaction (PkgcliContext *ctx, PkTransactionPast *transaction);
void			pkgc_print_error (PkgcliContext *ctx, const char *format, ...) G_GNUC_PRINTF (2, 3);
void			pkgc_print_warning (PkgcliContext *ctx, const char *format, ...) G_GNUC_PRINTF (2, 3);
void			pkgc_print_info (PkgcliContext *ctx, const char *format, ...) G_GNUC_PRINTF (2, 3);
void			pkgc_print_success (PkgcliContext *ctx, const char *format, ...) G_GNUC_PRINTF (2, 3);
void			pkgc_println (const char *format, ...) G_GNUC_PRINTF (1, 2);

gboolean		pkgc_is_local_package (const gchar *package_name);

GOptionContext	*pkgc_option_context_for_command (PkgcliContext *ctx,
												  PkgcliCommand *cmd,
												  const gchar *parameter_summary,
												  const gchar *description);
gboolean		pkgc_parse_command_options (PkgcliContext  *ctx,
											PkgcliCommand  *cmd,
											GOptionContext *option_context,
											gint		   *argc,
											gchar          ***argv,
											gint		   min_arg_count);



gchar			*pkgc_resolve_package (PkgcliContext *ctx,
										PkBitfield	  filters,
										const gchar	 *package_name,
										GError	**error);
gchar			**pkgc_resolve_packages (PkgcliContext *ctx,
										PkBitfield	   filters,
										gchar	 **packages,
										GError	 **error);

G_END_DECLS