Skip to content

Commit

Permalink
Merge pull request #941 from aschnell/master
Browse files Browse the repository at this point in the history
- make class OutputOptions reusable
  • Loading branch information
aschnell authored Oct 8, 2024
2 parents 0141bc5 + afacd83 commit 3472d87
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
19 changes: 1 addition & 18 deletions client/snapper/cmd-list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "../utils/TableFormatter.h"
#include "../utils/CsvFormatter.h"
#include "../utils/JsonFormatter.h"
#include "../utils/OutputOptions.h"
#include "dbus/DBusMessage.h"
#include "../utils/HumanString.h"

Expand Down Expand Up @@ -77,24 +78,6 @@ namespace snapper
enum class ListMode { ALL, SINGLE, PRE_POST };


/**
* Just a collection of some variables defining the output.
*/
class OutputOptions
{
public:

OutputOptions(bool utc, bool iso, bool human)
: utc(utc), iso(iso), human(human)
{
}

const bool utc;
const bool iso;
const bool human;
};


/**
* Some help for the output, e.g. check if a snapshot is the default or active
* snapshot, check if a snapshot should be skipped in the output or check if the
Expand Down
3 changes: 2 additions & 1 deletion client/utils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ libutils_la_SOURCES = \
Limit.cc Limit.h \
TableFormatter.cc TableFormatter.h \
CsvFormatter.cc CsvFormatter.h \
JsonFormatter.cc JsonFormatter.h
JsonFormatter.cc JsonFormatter.h \
OutputOptions.h

libutils_la_LIBADD = ../../snapper/libsnapper.la -ltinfo
45 changes: 45 additions & 0 deletions client/utils/OutputOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) [2011-2015] Novell, Inc.
* Copyright (c) [2016-2024] SUSE LLC
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* 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, contact Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail, you may
* find current contact information at www.novell.com.
*/


namespace snapper
{

/**
* Just a collection of some variables defining the output.
*/
class OutputOptions
{
public:

OutputOptions(bool utc, bool iso, bool human)
: utc(utc), iso(iso), human(human)
{
}

const bool utc;
const bool iso;
const bool human;

};

}

0 comments on commit 3472d87

Please sign in to comment.