aboutsummaryrefslogtreecommitdiffstats
path: root/commands/cd.go
Commit message (Collapse)AuthorAgeFilesLines
* commands: refactor registrationRobin Jarry2024-01-201-1/+5
| | | | | | | | | | | | | | | | | | Register all commands with the same function and store them in the same map. Use bit flags to determine in which contexts each command should be available. Remove duplicate commands now that the same command can be exposed in multiple contexts. Refactor API to allow executing commands from other commands without import cycles. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
* cd: fix completion of folders with a spaceRobin Jarry2024-01-171-12/+1
| | | | | | | | | | | | | | Folders that contain spaces are surrounded by quotes. They can never end with '/'. Hence they are never returned in the completion results. Update CompletePath with an additional onlyDirs argument to take care of this before quotes are inserted. Fixes: abe228b14d97 ("commands: use completion from go-opt") Fixes: https://todo.sr.ht/~rjarry/aerc/204 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* commands: use completion from go-optRobin Jarry2023-10-281-4/+3
| | | | | | | | | | | Implement command completion with complete struct field tags from the get-opt library introduced earlier. Changelog-changed: Improved command completion. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: parse arguments with go-optRobin Jarry2023-10-281-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the argument parsing framework introduced earlier to unify the parsing of (almost) all command options. Remove custom parsing code and to avoid extraneous types, add fields with `opt` tags on command structs that have options and arguments. Commands that take no argument do not need anything. Since the command objects now carry data, create a new temporary instance of them before passing them to opt.ArgsToStruct when executing a command. A few of the commands use specific semantics for parsing (:choose), or are delegating argument parsing to another function (:sort, :search, :filter). For these commands, simply add a dummy "-" passthrough argument. Since all commands still have the argument list (after split) nothing needs to be changed in this area. There should be no functional change besides the Usage strings and reported errors which are now generated automatically. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* app: export global functionsRobin Jarry2023-10-101-3/+3
| | | | | | | | | | | | | | | The single Aerc object is passed around in almost all command functions. This hinders readability. Store the single Aerc instance as a global variable. Export public functions from the app package to access methods of that object. Remove all explicit references to *app.Aerc and replace them with calls to these functions. For references to private/unexported fields and functions from within the app package, directly access the global aerc object. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* widgets: rename package to appRobin Jarry2023-10-101-3/+3
| | | | | | | | | This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* xdg: get rid of deprecated dependenciesRobin Jarry2023-08-271-5/+2
| | | | | | | | | | | github.com/mitchellh/go-homedir has not received any update since 2019. The last release of github.com/kyoh86/xdg was in 2020 and it has been marked as deprecated by its author. Replace these with internal functions. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
* statusline-format: add %p placeholder for current pathBence Ferdinandy2022-09-191-0/+1
| | | | | | | | | | Allow showing the current working directory in the statusline via [statusline] render-format=%p, which is useful if the user changes directories often. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-011-3/+1
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* go.mod: change base git urlRobin Jarry2021-11-051-1/+1
| | | | | | | I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
* Make commands join args with spacesJeffas2019-09-201-11/+5
| | | | | | | | | | | | | | | This patch ensures the following commands join their arguments with spaces to make it easier to interact with: - cf - mkdir - cd - attach - detach - ct - copy - move - save
* all: purge redundant underscoresWagner Riffel2019-09-041-3/+3
| | | | Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
* Add filesystem completions for :attach and :cdGalen Abell2019-08-021-1/+17
| | | | | Tab-completions now cycle through filesystem paths when using :attach or :cd commands.
* Implement basic tab completion supportGregory Mullen2019-06-291-2/+12
| | | | | Tab completion currently only works on commands. Contextual completion will be added in the future.
* Allow no arguments to :cdTadeo Kondrak2019-06-051-3/+5
| | | | I often use the bare `cd` command to get back to my home directory.
* s/aerc2/aerc/gDrew DeVault2019-05-171-1/+1
|
* Add context-specific commandsDrew DeVault2019-03-211-1/+1
|
* Fix help string for :cdDrew DeVault2019-03-151-1/+1
|
* Rename :cd -> :cf, add :cdDrew DeVault2019-03-151-11/+21
|
* Implement :cd commandDrew DeVault2019-03-141-0/+35