[Buildd-tools-devel] [PATCH 12/22] Add option to just list sessions (-s, --sessions)
Jan-Marek Glogowski
glogow at fbihome.de
Thu Mar 26 21:13:50 UTC 2009
---
bin/schroot/bash_completion/schroot | 2 +-
bin/schroot/schroot-options-base.cc | 20 +++++++++++++++++---
bin/schroot/schroot-options-base.h | 2 ++
bin/schroot/schroot-options.cc | 4 ++++
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/bin/schroot/bash_completion/schroot b/bin/schroot/bash_completion/schroot
index a0b7d4d..e4333ba 100644
--- a/bin/schroot/bash_completion/schroot
+++ b/bin/schroot/bash_completion/schroot
@@ -25,7 +25,7 @@ _schroot()
prev=${COMP_WORDS[COMP_CWORD-1]}
# Options should probably be autogenerated from the schroot build
# system, but using the current list is probably fine for now.
- options="--help --version --list --info --config --location --quiet --verbose --chroot --all --all-chroots --all-sessions --directory --user --preserve-environment --automatic-session --begin-session --recover-session --run-session --end-session --session-name --force -h -V -l -i -q -v -c -a -d -u -p -b -r -e -n -f"
+ options="--help --version --list --info --config --location --quiet --verbose --chroot --all --all-chroots --all-sessions --directory --user --preserve-environment --automatic-session --begin-session --recover-session --run-session --end-session --session-name --force --sessions -h -V -l -i -q -v -c -a -d -u -p -b -r -e -n -f -s"
if [ "$prev" = "-c" ]; then
COMPREPLY=( $(compgen -W "$(schroot -a -l)" -- $cur) )
diff --git a/bin/schroot/schroot-options-base.cc b/bin/schroot/schroot-options-base.cc
index b1276bd..8f7db54 100644
--- a/bin/schroot/schroot-options-base.cc
+++ b/bin/schroot/schroot-options-base.cc
@@ -48,6 +48,7 @@ options_base::options_base ():
command(),
user(),
preserve(false),
+ sessions(false),
all(false),
all_chroots(false),
all_sessions(false),
@@ -223,7 +224,12 @@ options_base::check_actions ()
// If not specified otherwise, load normal chroots, but allow
// --all options.
if (!all_used())
- this->load_chroots = true;
+ {
+ if (sessions)
+ this->load_sessions = true;
+ else
+ this->load_chroots = true;
+ }
if (this->all_chroots)
this->load_chroots = true;
if (this->all_sessions)
@@ -241,8 +247,16 @@ options_base::check_actions ()
this->load_chroots = this->load_sessions = true;
else if (!all_used()) // no chroots specified
{
- this->all_chroots = true;
- this->load_chroots = true;
+ if (sessions)
+ {
+ this->all_sessions = true;
+ this->load_sessions = true;
+ }
+ else
+ {
+ this->all_chroots = true;
+ this->load_chroots = true;
+ }
}
if (this->all_chroots)
this->load_chroots = true;
diff --git a/bin/schroot/schroot-options-base.h b/bin/schroot/schroot-options-base.h
index a73a9b1..9174bdc 100644
--- a/bin/schroot/schroot-options-base.h
+++ b/bin/schroot/schroot-options-base.h
@@ -89,6 +89,8 @@ namespace schroot
std::string user;
/// Preserve environment.
bool preserve;
+ /// Just use the sessions.
+ bool sessions;
/// Use all chroots and sessions.
bool all;
/// Use all chroots.
diff --git a/bin/schroot/schroot-options.cc b/bin/schroot/schroot-options.cc
index dae40bc..83dda3e 100644
--- a/bin/schroot/schroot-options.cc
+++ b/bin/schroot/schroot-options.cc
@@ -52,6 +52,8 @@ options::add_options ()
_("Print location of selected chroots"));
chroot.add_options()
+ ("sessions,s",
+ _("Select just the active sessions"))
("all,a",
_("Select all chroots and active sessions"))
("all-chroots",
@@ -96,6 +98,8 @@ options::check_options ()
if (vm.count("location"))
this->action = ACTION_LOCATION;
+ if (vm.count("sessions"))
+ this->sessions = true;
if (vm.count("all"))
this->all = true;
if (vm.count("all-chroots"))
--
1.6.2.1
More information about the Buildd-tools-devel
mailing list