stdlib-js / stdlib-js/stdlib

[RFC]: add support for bookmarking directories in REPL

Đang mở
#2,062 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
difficulty: 3 Enhancement JavaScript Needs Discussion priority: Normal REPL RFC
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
611

Mô tả

### Description

This RFC proposes adding support in the REPL for bookmarking directories. Currently, in order to move around the file system, one needs to manually set the current working directory. This can be tedious, as one needs to manually type file paths, either relative or absolute, in order to walk to the desired directory.

This RFC proposes alleviating that tedium by adding support for "bookmarking" directories. E.g.,

```
In [1]: saveBookmark( 'home_dir', '/home/foo/bar/beep/boop' );

// ...

In [n]: loadBookmark( 'home_dir' );
```

We'd want to add a set of complementary APIs:

- `saveBookmark( name[, path ] )`: path default is the current working directory
- `loadBookmark( name )`: set current working directory to the path associated with `name`
- `deleteBookmark( name )`: delete the bookmark associated with `name`
- `renameBookmark( prev, name )`: renames a bookmark specified by `prev` to the name specified by `name`
- `isBookmark( [path] )`: returns a boolean indicating if a specified path has been bookmarked (if no path provided, uses the current working directory as the path)

By default, bookmarks would only last for the REPL session. To support persisting benchmarks and loading previously persisted benchmarks, we could add the following APIs:

- `loadBookmarks( file )`: loads bookmarks found in the file specified by `file`
- `saveBookmarks( file )`: saves the current set of bookmarks to a file specified by `file`
- `clearBookmarks()`: clears all current bookmarks in the current REPL session
- `bookmarks()`: list all bookmarks in the current REPL session

The ability to dynamically load and remove bookmarks would allow users to quickly switch development contexts, similar to how the REPL's concept of workspaces allows for moving being variable contexts.

### Related Issues

No.

### Questions

- Are there other APIs which would be useful for working with bookmarks?

### Other

- It is worth ensuring that the APIs and conventions are consistent with how the REPL's concept of workspace APIs are designed (e.g., argument order, naming conventions, etc).
- We should ensure that, similar to workspaces, TAB completions support bookmark names.

### Checklist

- [X] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [X] Searched for existing issues and pull requests.
- [X] The issue name begins with `RFC:`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

No file or test is named in the issue. Start by locating the REPL workspace APIs and their TAB-completion handling, then compare their conventions with the proposed bookmark APIs. Done means the session and persistence operations, naming and argument conventions, and bookmark-name completion are defined consistently.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
cli
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.