2016-04-18 05:47:37 +00:00
|
|
|
// Prototypes for history functions, part of the user interface.
|
2005-10-04 15:11:39 +00:00
|
|
|
#ifndef FISH_HISTORY_H
|
|
|
|
#define FISH_HISTORY_H
|
|
|
|
|
2016-04-21 06:00:54 +00:00
|
|
|
// IWYU pragma: no_include <cstddef>
|
2015-07-25 15:14:25 +00:00
|
|
|
#include <pthread.h>
|
2017-02-13 04:24:22 +00:00
|
|
|
#include <stddef.h>
|
2015-07-25 15:14:25 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <time.h>
|
2016-11-15 05:31:51 +00:00
|
|
|
#include <wctype.h>
|
2017-02-14 04:37:27 +00:00
|
|
|
|
2016-04-18 05:47:37 +00:00
|
|
|
#include <deque>
|
2016-05-03 23:23:30 +00:00
|
|
|
#include <memory>
|
2015-07-25 15:14:25 +00:00
|
|
|
#include <string>
|
2018-01-31 02:30:30 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <unordered_set>
|
2016-04-18 05:47:37 +00:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
2016-04-21 06:00:54 +00:00
|
|
|
|
2016-04-18 05:47:37 +00:00
|
|
|
#include "common.h"
|
2016-04-21 06:00:54 +00:00
|
|
|
#include "wutil.h" // IWYU pragma: keep
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2016-07-14 05:33:50 +00:00
|
|
|
struct io_streams_t;
|
2020-02-08 20:23:39 +00:00
|
|
|
class env_stack_t;
|
2018-09-18 16:18:47 +00:00
|
|
|
class environment_t;
|
2020-12-31 21:30:58 +00:00
|
|
|
class operation_context_t;
|
2016-07-14 05:33:50 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/**
|
|
|
|
Fish supports multiple shells writing to history at once. Here is its strategy:
|
|
|
|
|
|
|
|
1. All history files are append-only. Data, once written, is never modified.
|
|
|
|
|
|
|
|
2. A history file may be re-written ("vacuumed"). This involves reading in the file and writing a
|
|
|
|
new one, while performing maintenance tasks: discarding items in an LRU fashion until we reach
|
|
|
|
the desired maximum count, removing duplicates, and sorting them by timestamp (eventually, not
|
|
|
|
implemented yet). The new file is atomically moved into place via rename().
|
|
|
|
|
|
|
|
3. History files are mapped in via mmap(). Before the file is mapped, the file takes a fcntl read
|
|
|
|
lock. The purpose of this lock is to avoid seeing a transient state where partial data has been
|
|
|
|
written to the file.
|
|
|
|
|
|
|
|
4. History is appended to under a fcntl write lock.
|
|
|
|
|
|
|
|
5. The chaos_mode boolean can be set to true to do things like lower buffer sizes which can
|
|
|
|
trigger race conditions. This is useful for testing.
|
|
|
|
*/
|
|
|
|
using path_list_t = std::vector<wcstring>;
|
2012-02-15 19:33:41 +00:00
|
|
|
|
2019-11-03 01:56:16 +00:00
|
|
|
enum class history_search_type_t {
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Search for commands exactly matching the given string.
|
2019-11-03 01:56:16 +00:00
|
|
|
exact,
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Search for commands containing the given string.
|
2019-11-03 01:56:16 +00:00
|
|
|
contains,
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Search for commands starting with the given string.
|
2019-11-03 01:56:16 +00:00
|
|
|
prefix,
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Search for commands containing the given glob pattern.
|
2019-11-03 01:56:16 +00:00
|
|
|
contains_glob,
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Search for commands starting with the given glob pattern.
|
2019-11-03 01:56:16 +00:00
|
|
|
prefix_glob,
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Matches everything.
|
2019-11-03 02:33:45 +00:00
|
|
|
match_everything,
|
2012-02-06 18:52:13 +00:00
|
|
|
};
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
using history_identifier_t = uint64_t;
|
2014-03-29 06:22:03 +00:00
|
|
|
|
2021-01-02 22:34:19 +00:00
|
|
|
/// Ways that a history item may be written to disk (or omitted).
|
|
|
|
enum class history_persistence_mode_t : uint8_t {
|
|
|
|
disk, // the history item is written to disk normally
|
|
|
|
memory, // the history item is stored in-memory only, not written to disk
|
|
|
|
ephemeral, // the history item is stored in-memory and deleted when a new item is added
|
|
|
|
};
|
|
|
|
|
2016-04-18 05:47:37 +00:00
|
|
|
class history_item_t {
|
2021-01-01 23:12:50 +00:00
|
|
|
public:
|
2021-01-02 22:34:19 +00:00
|
|
|
/// Construct from a text, timestamp, and optional identifier.
|
2021-12-12 21:36:14 +00:00
|
|
|
/// If \p persist_mode is ::ephemeral, then do not write this item to disk.
|
2021-01-02 22:34:19 +00:00
|
|
|
explicit history_item_t(
|
|
|
|
wcstring str = {}, time_t when = 0, history_identifier_t ident = 0,
|
|
|
|
history_persistence_mode_t persist_mode = history_persistence_mode_t::disk);
|
2021-01-01 23:12:50 +00:00
|
|
|
|
|
|
|
/// \return the text as a string.
|
|
|
|
const wcstring &str() const { return contents; }
|
|
|
|
|
|
|
|
/// \return whether the text is empty.
|
|
|
|
bool empty() const { return contents.empty(); }
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// \return wehther our contents matches a search term.
|
2021-01-01 23:12:50 +00:00
|
|
|
bool matches_search(const wcstring &term, enum history_search_type_t type,
|
|
|
|
bool case_sensitive) const;
|
|
|
|
|
|
|
|
/// \return the timestamp for creating this history item.
|
|
|
|
time_t timestamp() const { return creation_timestamp; }
|
|
|
|
|
2021-01-02 22:34:19 +00:00
|
|
|
/// \return whether this item should be persisted (written to disk).
|
|
|
|
bool should_write_to_disk() const { return persist_mode == history_persistence_mode_t::disk; }
|
|
|
|
|
2021-01-01 23:12:50 +00:00
|
|
|
/// Get and set the list of arguments which referred to files.
|
|
|
|
/// This is used for autosuggestion hinting.
|
|
|
|
const path_list_t &get_required_paths() const { return required_paths; }
|
|
|
|
void set_required_paths(path_list_t paths) { required_paths = std::move(paths); }
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2016-04-18 05:47:37 +00:00
|
|
|
private:
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Attempts to merge two compatible history items together.
|
2012-03-01 22:56:34 +00:00
|
|
|
bool merge(const history_item_t &item);
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// The actual contents of the entry.
|
2019-08-11 20:41:04 +00:00
|
|
|
wcstring contents;
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Original creation time for the entry.
|
2012-11-19 00:30:30 +00:00
|
|
|
time_t creation_timestamp;
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Paths that we require to be valid for this item to be autosuggested.
|
2021-01-02 22:34:19 +00:00
|
|
|
path_list_t required_paths;
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Sometimes unique identifier used for hinting.
|
2014-03-29 06:22:03 +00:00
|
|
|
history_identifier_t identifier;
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// If set, do not write this item to disk.
|
2021-01-02 22:34:19 +00:00
|
|
|
history_persistence_mode_t persist_mode;
|
2015-09-19 03:47:38 +00:00
|
|
|
|
2021-01-01 23:12:50 +00:00
|
|
|
friend class history_t;
|
|
|
|
friend struct history_impl_t;
|
|
|
|
friend class history_lru_cache_t;
|
|
|
|
friend class history_tests_t;
|
2012-06-15 23:22:37 +00:00
|
|
|
};
|
2012-06-05 04:24:42 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
using history_item_list_t = std::deque<history_item_t>;
|
2014-03-29 06:22:03 +00:00
|
|
|
|
2019-06-15 00:18:43 +00:00
|
|
|
struct history_impl_t;
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2021-07-22 17:43:25 +00:00
|
|
|
class history_t : noncopyable_t, nonmovable_t {
|
2012-02-16 08:24:27 +00:00
|
|
|
friend class history_tests_t;
|
2020-05-22 18:25:38 +00:00
|
|
|
struct impl_wrapper_t;
|
|
|
|
const std::unique_ptr<impl_wrapper_t> wrap_;
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2019-06-15 00:18:43 +00:00
|
|
|
acquired_lock<history_impl_t> impl();
|
|
|
|
acquired_lock<const history_impl_t> impl() const;
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Privately add an item. If pending, the item will not be returned by history searches until a
|
|
|
|
/// call to resolve_pending. Any trailing ephemeral items are dropped.
|
2021-03-21 15:06:14 +00:00
|
|
|
void add(history_item_t &&item, bool pending = false);
|
2021-01-02 22:34:19 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Add a new history item with text \p str to the end of history.
|
2021-01-02 22:34:19 +00:00
|
|
|
void add(wcstring str);
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2016-04-18 05:47:37 +00:00
|
|
|
public:
|
2018-07-14 21:29:19 +00:00
|
|
|
explicit history_t(wcstring name);
|
|
|
|
~history_t();
|
2016-03-18 22:14:16 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Whether we're in maximum chaos mode, useful for testing.
|
|
|
|
/// This causes things like locks to fail.
|
2018-07-15 18:50:02 +00:00
|
|
|
static bool chaos_mode;
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Whether to force the read path instead of mmap. This is useful for testing.
|
2018-07-15 18:50:02 +00:00
|
|
|
static bool never_mmap;
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Returns history with the given name, creating it if necessary.
|
2021-01-10 00:22:32 +00:00
|
|
|
static std::shared_ptr<history_t> with_name(const wcstring &name);
|
2016-03-18 22:14:16 +00:00
|
|
|
|
2018-09-18 16:18:47 +00:00
|
|
|
/// Returns whether this is using the default name.
|
|
|
|
bool is_default() const;
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Determines whether the history is empty. Unfortunately this cannot be const, since it may
|
|
|
|
/// require populating the history.
|
2018-07-14 18:47:34 +00:00
|
|
|
bool is_empty();
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Remove a history item.
|
2012-06-05 04:24:42 +00:00
|
|
|
void remove(const wcstring &str);
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-01-02 22:34:19 +00:00
|
|
|
/// Remove any trailing ephemeral items.
|
|
|
|
void remove_ephemeral_items();
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Add a new pending history item to the end, and then begin file detection on the items to
|
|
|
|
/// determine which arguments are paths. Arguments may be expanded (e.g. with PWD and variables)
|
|
|
|
/// using the given \p vars. The item has the given \p persist_mode.
|
2021-01-10 00:22:32 +00:00
|
|
|
static void add_pending_with_file_detection(
|
|
|
|
const std::shared_ptr<history_t> &self, const wcstring &str,
|
|
|
|
const std::shared_ptr<environment_t> &vars,
|
2021-01-02 22:34:19 +00:00
|
|
|
history_persistence_mode_t persist_mode = history_persistence_mode_t::disk);
|
2015-09-19 03:47:38 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Resolves any pending history items, so that they may be returned in history searches.
|
2015-04-20 09:04:17 +00:00
|
|
|
void resolve_pending();
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Saves history.
|
2012-02-06 00:42:24 +00:00
|
|
|
void save();
|
2014-03-31 17:01:39 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Searches history.
|
2019-06-15 00:18:43 +00:00
|
|
|
bool search(history_search_type_t search_type, const wcstring_list_t &search_args,
|
2017-09-14 22:44:17 +00:00
|
|
|
const wchar_t *show_time_format, size_t max_items, bool case_sensitive,
|
2020-01-16 23:11:24 +00:00
|
|
|
bool null_terminate, bool reverse, const cancel_checker_t &cancel_check,
|
|
|
|
io_streams_t &streams);
|
2018-08-12 07:30:57 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Irreversibly clears history.
|
2012-02-16 08:24:27 +00:00
|
|
|
void clear();
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Irreversibly clears history for the current session.
|
2021-10-18 02:27:46 +00:00
|
|
|
void clear_session();
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Populates from older location (in config path, rather than data path).
|
2015-09-19 03:47:38 +00:00
|
|
|
void populate_from_config_path();
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Populates from a bash history file.
|
2012-06-15 23:22:37 +00:00
|
|
|
void populate_from_bash(FILE *f);
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Incorporates the history of other shells into this history.
|
2014-07-25 17:08:21 +00:00
|
|
|
void incorporate_external_changes();
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Gets all the history into a list. This is intended for the $history environment variable.
|
|
|
|
/// This may be long!
|
2017-08-25 01:59:50 +00:00
|
|
|
void get_history(wcstring_list_t &result);
|
2014-03-31 17:01:39 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Let indexes be a list of one-based indexes into the history, matching the interpretation of
|
|
|
|
/// $history. That is, $history[1] is the most recently executed command. Values less than one
|
|
|
|
/// are skipped. Return a mapping from index to history item text.
|
2018-01-31 02:30:30 +00:00
|
|
|
std::unordered_map<long, wcstring> items_at_indexes(const std::vector<long> &idxs);
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Return the specified history at the specified index. 0 is the index of the current
|
|
|
|
/// commandline. (So the most recent item is at index 1.)
|
2012-02-06 00:42:24 +00:00
|
|
|
history_item_t item_at_index(size_t idx);
|
2017-09-14 22:44:17 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Return the number of history entries.
|
2017-09-14 22:44:17 +00:00
|
|
|
size_t size();
|
2012-02-06 00:42:24 +00:00
|
|
|
};
|
|
|
|
|
2018-08-12 07:30:57 +00:00
|
|
|
/// Flags for history searching.
|
|
|
|
enum {
|
2021-12-12 21:36:14 +00:00
|
|
|
/// If set, ignore case.
|
2018-08-12 07:30:57 +00:00
|
|
|
history_search_ignore_case = 1 << 0,
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// If set, do not deduplicate, which can help performance.
|
2018-08-12 07:30:57 +00:00
|
|
|
history_search_no_dedup = 1 << 1
|
|
|
|
};
|
|
|
|
using history_search_flags_t = uint32_t;
|
|
|
|
|
|
|
|
/// Support for searching a history backwards.
|
|
|
|
/// Note this does NOT de-duplicate; it is the caller's responsibility to do so.
|
2016-04-18 05:47:37 +00:00
|
|
|
class history_search_t {
|
2016-07-14 05:33:50 +00:00
|
|
|
private:
|
2021-12-12 21:36:14 +00:00
|
|
|
/// The history in which we are searching.
|
|
|
|
/// TODO: this should be a shared_ptr.
|
2018-08-12 07:30:57 +00:00
|
|
|
history_t *history_;
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// The original search term.
|
2018-08-12 07:30:57 +00:00
|
|
|
wcstring orig_term_;
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// The (possibly lowercased) search term.
|
2018-08-12 07:30:57 +00:00
|
|
|
wcstring canon_term_;
|
2016-10-17 04:15:40 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Our search type.
|
2019-11-03 01:56:16 +00:00
|
|
|
enum history_search_type_t search_type_ { history_search_type_t::contains };
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Our flags.
|
2018-08-12 07:30:57 +00:00
|
|
|
history_search_flags_t flags_{0};
|
2012-02-06 06:30:42 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// The current history item.
|
2018-08-12 07:30:57 +00:00
|
|
|
maybe_t<history_item_t> current_item_;
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Index of the current history item.
|
2018-08-12 07:30:57 +00:00
|
|
|
size_t current_index_{0};
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// If deduping, the items we've seen.
|
2018-08-12 07:30:57 +00:00
|
|
|
std::unordered_set<wcstring> deduper_;
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// return whether we are case insensitive.
|
2018-08-12 07:30:57 +00:00
|
|
|
bool ignores_case() const { return flags_ & history_search_ignore_case; }
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// return whether we deduplicate items.
|
2018-08-12 07:30:57 +00:00
|
|
|
bool dedup() const { return !(flags_ & history_search_no_dedup); }
|
2012-02-06 19:52:24 +00:00
|
|
|
|
2018-08-12 07:30:57 +00:00
|
|
|
public:
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Gets the original search term.
|
2018-08-12 07:30:57 +00:00
|
|
|
const wcstring &original_term() const { return orig_term_; }
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Finds the previous search result (backwards in time). Returns true if one was found.
|
2018-07-14 18:47:34 +00:00
|
|
|
bool go_backwards();
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Returns the current search result item. asserts if there is no current item.
|
2019-11-03 01:27:35 +00:00
|
|
|
const history_item_t ¤t_item() const;
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Returns the current search result item contents. asserts if there is no current item.
|
2019-11-03 01:27:35 +00:00
|
|
|
const wcstring ¤t_string() const;
|
2012-02-16 08:24:27 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Construct from a history pointer; the caller is responsible for ensuring the history stays
|
|
|
|
/// alive.
|
2021-01-10 00:22:32 +00:00
|
|
|
history_search_t(history_t *hist, const wcstring &str,
|
2019-11-03 01:56:16 +00:00
|
|
|
enum history_search_type_t type = history_search_type_t::contains,
|
2018-08-12 07:30:57 +00:00
|
|
|
history_search_flags_t flags = 0)
|
2021-01-10 00:22:32 +00:00
|
|
|
: history_(hist), orig_term_(str), canon_term_(str), search_type_(type), flags_(flags) {
|
2018-08-12 07:30:57 +00:00
|
|
|
if (ignores_case()) {
|
|
|
|
std::transform(canon_term_.begin(), canon_term_.end(), canon_term_.begin(), towlower);
|
2016-09-24 03:12:15 +00:00
|
|
|
}
|
|
|
|
}
|
2012-02-06 00:42:24 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/// Construct from a shared_ptr. TODO: this should be the only constructor.
|
2021-01-10 00:22:32 +00:00
|
|
|
history_search_t(const std::shared_ptr<history_t> &hist, const wcstring &str,
|
|
|
|
enum history_search_type_t type = history_search_type_t::contains,
|
|
|
|
history_search_flags_t flags = 0)
|
|
|
|
: history_search_t(hist.get(), str, type, flags) {}
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/** Default constructor. */
|
2018-08-12 07:30:57 +00:00
|
|
|
history_search_t() = default;
|
2012-02-06 00:42:24 +00:00
|
|
|
};
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/** Saves the new history to disk. */
|
2018-02-11 01:21:55 +00:00
|
|
|
void history_save_all();
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/** Return the prefix for the files to be used for command and read history. */
|
2018-09-18 16:18:47 +00:00
|
|
|
wcstring history_session_id(const environment_t &vars);
|
2017-07-01 00:13:02 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/**
|
|
|
|
Given a list of proposed paths and a context, perform variable and home directory expansion,
|
|
|
|
and detect if the result expands to a value which is also the path to a file.
|
|
|
|
Wildcard expansions are suppressed - see implementation comments for why.
|
|
|
|
This is used for autosuggestion hinting. If we add an item to history, and one of its arguments
|
|
|
|
refers to a file, then we only want to suggest it if there is a valid file there.
|
|
|
|
This does disk I/O and may only be called in a background thread.
|
|
|
|
*/
|
2020-12-31 21:30:58 +00:00
|
|
|
path_list_t expand_and_detect_paths(const path_list_t &paths, const environment_t &vars);
|
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/**
|
|
|
|
Given a list of proposed paths and a context, expand each one and see if it refers to a file.
|
|
|
|
Wildcard expansions are suppressed.
|
|
|
|
\return true if \p paths is empty or every path is valid.
|
|
|
|
*/
|
2020-12-31 21:30:58 +00:00
|
|
|
bool all_paths_are_valid(const path_list_t &paths, const operation_context_t &ctx);
|
2018-09-19 23:56:08 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/** Sets private mode on. Once in private mode, it cannot be turned off. */
|
2020-02-08 20:23:39 +00:00
|
|
|
void start_private_mode(env_stack_t &vars);
|
2021-01-01 21:57:45 +00:00
|
|
|
|
2021-12-12 21:36:14 +00:00
|
|
|
/** Queries private mode status. */
|
2021-01-01 21:57:45 +00:00
|
|
|
bool in_private_mode(const environment_t &vars);
|
2019-11-05 15:47:01 +00:00
|
|
|
|
2005-10-04 15:11:39 +00:00
|
|
|
#endif
|