Commit Graph

32 Commits

Author SHA1 Message Date
Simon Schürrle
c55df583d5 Replace re:replace with replaces in epm (#756)
By using `replaces` it doesn't attempt to interpret \U as regex escape sequence. The \U comes from `C:\Users` which is like `/home` on Linux. 

This closes #755
2018-09-24 00:09:40 +01:00
Kye W. Shi
f9ef4e6236 edit/edcore: Implement functions for word-based movement. (#721)
* edit/edcore: Implement some insert-mode functions for word-based movement.

Implemented `kill-word-right`, `kill-small-word-right`, `move-dot-left-small-word`, and `move-dot-right-small-word`.

* eval/bundled: Create default bindings for `kill-word-left` and `kill-word-right`.

* edit/edcore: Fix a dumb arithmetic error in `kill-word-right`.

* edit/edcore: Purify move- and kill- buffer commands.

* Implement category-based movement, per discussions in #696

* edit/edcore: Design unit tests for moveDot functions.

* edit/edcore: Revise categorizer-based movement for clarity; rewrite some comments.
2018-08-07 12:03:29 +02:00
fehnomenal
e89fe48870 Add styled and styled-segment builtins (#674)
* Add compatibility test with old implementation

* Add color type

* Add basic style structs and utilities

* Add structs for styled segments and texts

* Add default style transformers to reimplement $edit:styled~

* Add builtins to manipulate styled segments and texts

* Rename style 'underline' -> 'underlined'

* Fix test case

* Add conversion from styled text to ansi sequences

* Return errors rather than throwing

* Validate the type of boolean options

* Delegate old to new styled function

* Rebase for new test framework api and expand test cases

* Remove old builtin function $edit:styled~

* Use strings to represent colors

* Convert bool pointers to simple bool values

* Validate color strings

* Do no longer expose builtin style transformers

* Fix confusion about pointers

* Make outputs more stable

* Expand tests

* Use pointers instead of passing setter functions

* Unexport and rename color check

* Use the empty string for default colors

* Expand tests

* Simplify styled transformers

Now there are three transformers for each boolean style attribute that
allow setting, unsetting and toggling the corresponding attribute.

* Rework and add doc comments
2018-05-28 21:24:09 +01:00
Diego Zamboni
bac2d37023 Cleanup and fixes in epm:installed (#656)
* Remove use of external commands in epm:installed

Remove dependency on the ls and find commands, which introduced some
problems, particularly due to differences in find versions.

Fixes https://github.com/elves/elvish/issues/655

* Remove module name references

* Code cleanup

- Renamed internal functions to start with -
- Reorganized some functions
2018-03-30 01:42:51 +01:00
Diego Zamboni
4ed724a0a3 Abbreviate dir names in location and speed up history (#654)
- Pass directories through tilde-abbr before displaying them
- Leave tabs and newlines in history mode. Makes it MUCH faster for
  the listing to appear.
2018-03-30 01:42:39 +01:00
Diego Zamboni
8371565531 Don't crash when git update fails (#628)
* Don't crash when git update fails

When git update fails for any reason (i.e. not a git repo, unstaged
changes, etc.), catch the exception and print an error, but don't crash.

Fixes #626

* Use try to catch git errors
2018-03-12 11:54:37 +00:00
Qi Xiao
1108e01457 edit: Further decouple history and histlist mode from editor. 2018-02-15 08:42:07 +00:00
Qi Xiao
ebdcf1178c edit: Put lastcmd in new edit/lastcmd package. 2018-02-08 23:16:31 -08:00
Diego Zamboni
c182f8e488 Clean up and allow tilde in rsync's location
- Cleaned up utility functions
- If the location attribute in an rsync domain contains a tilde at the
  beginning, it gets expanded to the user's home directory.
2018-01-24 23:54:52 +00:00
Diego Zamboni
b8cd3ae494 Pretty-print list metadata attributes in epm:query 2018-01-24 23:54:52 +00:00
Diego Zamboni
55c3ba0be4 Added error checking after dependency installs
If the installation of the package dependencies fails, we print an error
and leave any already-installed dependencies in place, but remove the
target package.
2018-01-24 23:54:52 +00:00
Diego Zamboni
d7ada09cc4 Added missing error check in epm:install 2018-01-24 23:54:52 +00:00
Diego Zamboni
d2fd4e245b Made epm:list an alias for epm:installed 2018-01-24 23:54:52 +00:00
Diego Zamboni
4e84d3e0ab Added simple dependency management
If an installed package has a metadata file, and if the metadata has a
`dependencies` key, then it is expected to be a list of strings
indicating packages that must also be installed.

There is still no error handling for this. If the
installation of dependencies fails, should we just uninstall everything?
Feedback welcome.
2018-01-24 23:54:52 +00:00
Diego Zamboni
bc8a8a9958 Addressed feedback from PR
- Use `bool` instead of my hand-concocted contramption :)
- Make variable name in `metadata` more readable.
2018-01-24 23:54:52 +00:00
Diego Zamboni
8b716e688a Improvements to query function
Use the improved `metadata`, and prettify the output.
2018-01-24 23:54:52 +00:00
Diego Zamboni
b518f72b94 Improvements to metadata function
The `metadata` function now returns not only package-provided metadata
(if any) but also some base attributes such as package name, install
status, source and destination (if installed), and install method.
2018-01-24 23:54:52 +00:00
Diego Zamboni
9c554a89fa Force output of is-installed to $true or $false 2018-01-24 23:54:52 +00:00
Diego Zamboni
454107e150 Terser error messages 2018-01-20 16:06:25 +00:00
Diego Zamboni
713e7c567f Fixed syntax error 2018-01-20 16:06:25 +00:00
Diego Zamboni
2262857e1d Addressed feedback
- Improved splits/joins lines
- Removed in-memory domain config caching
- Disabled creation of domain config files by default, new function
  `-write-domain-config` can be used when needed.
- Made error statements more consistent
2018-01-20 16:06:25 +00:00
Diego Zamboni
2bd469c2a3 Improved comments 2018-01-20 16:06:25 +00:00
Diego Zamboni
5f9e4d2fdd Use "src" function in -method-handler
Modified the -method-handler install and upgrade functions to use their
own "src" function instead of hardcoding it.
2018-01-20 16:06:25 +00:00
Diego Zamboni
bf35e6ca62 Added src method operation
Each package method now supports a `src` function which returns the
source from which the package is fetched. The `epm:query` function
prints this information as well.
2018-01-20 16:06:25 +00:00
Diego Zamboni
c1b4db82f3 Initial epm:query function
The `epm:query` function shows whether a package is installed, its
location, and if it has any metadata it prints it out.
2018-01-20 16:06:25 +00:00
Diego Zamboni
bef85298f1 Initial package metadata support
If a `metadata.json` file exists in the top-level directory of the
package, then the `epm:metadata` file reads it, parses it and returns it
as a data structure. The metadata is not used for anything at this
moment, nor is its structure or contents enforced in any way.
2018-01-20 16:06:25 +00:00
Diego Zamboni
51c43902cd Added domain configs for gitlab.com and bitbucket.org 2018-01-20 16:06:25 +00:00
Diego Zamboni
40af977467 File-based epm implementation
Reimplementation of epm to be fully file-based, with per-domain
configuration for different package installation methods. The scheme is
described in
https://github.com/elves/elvish/pull/547#issuecomment-354560975. In
short:

- Packages are specified as `domain/package`. For example,
`github.com/zzamboni/modules.elv`
- Packages are stored under `~/.elvish/lib` under their full path. For
example, `~/.elvish/lib/github.com/zzamboni/modules.elv/`
- Each domain has a configuration file stored in
`~/.elvish/lib/<domain>/epm-domain.cfg`. Currently epm has built-in
domain configuration for the `github.com` domain. This file is a JSON file which
contains the following fields:

  - `method` specifies the method used to transfer the module files.
    Currently supported are `git` and `rsync`.
  - `levels` specifies how many directories under the domain directory
    are packages located. For example, the github.com domain has
    `levels` set to 2, which means the packages are directories stored
    2 levels under `~/.elvish/lib/github.com`.
  - Other fields may be specified, depending on the method. For example,
    method `git` needs `protocol` (e.g. `https` or `git`) and
    method `rsync` needs `location` (the location from which to rsync the
    files).

For domains with built-in configuration (github.com at the moment), the
`epm-domain.cfg` file is created automatically the first time a package
from that domain is installed. For others, you have to create the file
by hand. For example, to have a "dev" domain which installs packages
specified as `dev/foo` from `~/devel/foo`, you must create file
`~/.elvish/lib/dev/epm-domain.cfg` containing the following:

```
{
   "method" : "rsync",
   "location" : "/Users/taazadi1/Personal/devel/elvish/dev",
   "levels" : "1"
}
```
2018-01-20 16:06:25 +00:00
Diego Zamboni
8d13e18323 Fix function references for new syntax 2018-01-08 14:33:07 +00:00
Diego Zamboni
e5c1568af9 Fix casing of the Default binding for narrow.elv 2018-01-08 12:31:39 +00:00
Qi Xiao
837f124f13 edit: Default binding is now set in Elvish script. 2018-01-03 07:27:46 +00:00
Qi Xiao
e49b4e8cd1 eval: Move bundled modules to eval/bundled. 2017-12-31 20:07:26 +00:00