diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 8e7b898e5..e15136487 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -168,6 +168,8 @@ Removed thus removed. - All `--qt-*` arguments got replaced by `--qt-arg` and `--qt-flag` and thus removed. +- The `-c`/`--confdir`, `--datadir` and `--cachedir` arguments got removed, as + `--basedir` should be sufficient. Fixed ~~~~~ diff --git a/doc/qutebrowser.1.asciidoc b/doc/qutebrowser.1.asciidoc index 8b856ccb3..989fbd3cd 100644 --- a/doc/qutebrowser.1.asciidoc +++ b/doc/qutebrowser.1.asciidoc @@ -38,17 +38,8 @@ show it. *-h*, *--help*:: show this help message and exit -*-c* 'CONFDIR', *--confdir* 'CONFDIR':: - Set config directory - -*--datadir* 'DATADIR':: - Set data directory - -*--cachedir* 'CACHEDIR':: - Set cache directory - *--basedir* 'BASEDIR':: - Base directory for all storage. Other --*dir arguments are ignored if this is given. + Base directory for all storage. *-V*, *--version*:: Show version and quit. diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 7a9260bc7..edc19931c 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -320,8 +320,8 @@ def _open_quickstart(args): Args: args: The argparse namespace. """ - if args.datadir is not None or args.basedir is not None: - # With --datadir or --basedir given, don't open quickstart. + if args.basedir is not None: + # With --basedir given, don't open quickstart. return state_config = objreg.get('state-config') try: diff --git a/qutebrowser/qutebrowser.py b/qutebrowser/qutebrowser.py index de80b972b..420a07d0c 100644 --- a/qutebrowser/qutebrowser.py +++ b/qutebrowser/qutebrowser.py @@ -47,13 +47,7 @@ def get_argparser(): """Get the argparse parser.""" parser = argparse.ArgumentParser(prog='qutebrowser', description=qutebrowser.__description__) - parser.add_argument('-c', '--confdir', help="Set config directory", - type=directory) - parser.add_argument('--datadir', help="Set data directory", type=directory) - parser.add_argument('--cachedir', help="Set cache directory", - type=directory) - parser.add_argument('--basedir', help="Base directory for all storage. " - "Other --*dir arguments are ignored if this is given.") + parser.add_argument('--basedir', help="Base directory for all storage.") parser.add_argument('-V', '--version', help="Show version and quit.", action='store_true') parser.add_argument('-s', '--set', help="Set a temporary setting for " diff --git a/qutebrowser/utils/standarddir.py b/qutebrowser/utils/standarddir.py index cbfa2555c..2903ad6bd 100644 --- a/qutebrowser/utils/standarddir.py +++ b/qutebrowser/utils/standarddir.py @@ -145,11 +145,6 @@ def _from_args(typ, args): override: boolean, if the user did override the path path: The overridden path, or None to turn off storage. """ - typ_to_argparse_arg = { - QStandardPaths.ConfigLocation: 'confdir', - QStandardPaths.DataLocation: 'datadir', - QStandardPaths.CacheLocation: 'cachedir', - } basedir_suffix = { QStandardPaths.ConfigLocation: 'config', QStandardPaths.DataLocation: 'data', @@ -170,18 +165,6 @@ def _from_args(typ, args): return (False, None) return (True, os.path.abspath(os.path.join(basedir, suffix))) - try: - argname = typ_to_argparse_arg[typ] - except KeyError: - return (False, None) - arg_value = getattr(args, argname) - - assert arg_value != '', argname - if arg_value is None: - return (False, None) - else: - return (True, arg_value) - def _create(path): """Create the `path` directory. diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index 96a121b3f..2d92fa1fc 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -163,54 +163,7 @@ DirArgTest = collections.namedtuple('DirArgTest', 'arg, expected') @pytest.mark.usefixtures('reset_standarddir') class TestArguments: - """Tests with confdir/cachedir/datadir arguments.""" - - @pytest.fixture(params=[DirArgTest('foo', 'foo')]) - def testcase(self, request, tmpdir): - """Fixture providing testcases.""" - # prepend tmpdir to both - arg = str(tmpdir / request.param.arg) - return DirArgTest(arg, arg) - - def test_confdir(self, testcase): - """Test --confdir.""" - args = types.SimpleNamespace(confdir=testcase.arg, cachedir=None, - datadir=None, basedir=None) - standarddir.init(args) - assert standarddir.config() == testcase.expected - - def test_cachedir(self, testcase): - """Test --cachedir.""" - args = types.SimpleNamespace(confdir=None, cachedir=testcase.arg, - datadir=None, basedir=None) - standarddir.init(args) - assert standarddir.cache() == testcase.expected - - def test_datadir(self, testcase): - """Test --datadir.""" - args = types.SimpleNamespace(confdir=None, cachedir=None, - datadir=testcase.arg, basedir=None) - standarddir.init(args) - assert standarddir.data() == testcase.expected - - def test_confdir_none(self, mocker): - """Test --confdir with None given.""" - # patch makedirs to a noop so we don't really create a directory - mocker.patch('qutebrowser.utils.standarddir.os.makedirs') - args = types.SimpleNamespace(confdir=None, cachedir=None, datadir=None, - basedir=None) - standarddir.init(args) - assert standarddir.config().split(os.sep)[-1] == 'qute_test' - - def test_runtimedir(self, tmpdir, monkeypatch): - """Test runtime dir (which has no args).""" - monkeypatch.setattr( - 'qutebrowser.utils.standarddir.QStandardPaths.writableLocation', - lambda _typ: str(tmpdir)) - args = types.SimpleNamespace(confdir=None, cachedir=None, - datadir=None, basedir=None) - standarddir.init(args) - assert standarddir.runtime() == str(tmpdir / 'qute_test') + """Tests the --basedir argument.""" @pytest.mark.parametrize('typ', ['config', 'data', 'cache', 'download', pytest.mark.linux('runtime')])