Code Monkey home page Code Monkey logo

septum's People

Contributors

jquorning avatar pyjarrett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

septum's Issues

[Feature] Ctrl-C during search should stop

Some searches dump a lot of output for a long time. Ctrl-C should be used to stop the search or the printing of search results.

Alternatives

  • Don't allow dumping of results exceeding a specific size.

Document .septum/.config usage

The usage of load-time command scripts via .septum/.config fileswithin the user's home directory and current working directory is not documented and should be included in program help.

[Feature] Ctrl-D in prompt could exit program

Is your feature request related to a problem? Please describe.
I can exit the program only by typing 'quit'. I would like to be able to exit using a keyboard shortcut.

Describe the solution you'd like
When the user presses Ctrl-D, the program exits. Programs like python do this when the user is in the prompt.

[Feature] Add filters for text in file names

I'm finding that sometimes the best way to filter large numbers of results is to remove large portions of the search tree.

It'd be easier to be able to add keep/exclude filters like used for contexts, but which would apply to file names. This might also replace the need to only search specific extensions.

[Feature] Save filters and output to file.

I often find myself needing search results later and I find myself copying and pasting searches to save them for later.

A command should exist to save the a search and its results to disk. This might be to separate files, one with commands which could be sourced at a later time to restore the search (such as to have its results compared), but this need is further down the road. Any file written with search results should be timestamped.

Possibles solution, not sure if export or save is the right command name here:

save <file_name>

save "Importing_C_Functions"

results in Importing_C_Functions.septum and Import_C_Functions.YYYYMMDD.HHMM.txt in the closest .septum/ directory.

  • Handles case of preexisting search filename
  • Handles case of results with the same filename.

[Feature] Matching lines should be highlighted in a user specified color.

  • Using GNATCOLL.Terminal provide colorized output for lines which include a match.
  • Provide enable-line-colors and disable-line-colors commands to toggle the setting on/off respectively
  • Hide all of this behavior behind SP.Terminal, causing color commands to be ignored if coloration is turned off.

[Feature] Case insensitive search

There needs to be an intermediate option between case-sensitive search, and using regular expressions for describing search text. Regular expression usage for case-insensitive is very verbose, since the regexp parser doesn't currently allow for special flags.

Possible Solution

  • Add new commands find-like and exclude-like to apply case-insensitive filters.

Alternatives

  • Adding options to find-text and exclude-text such as --case-insensitive. This would require option parsing for commands.

[Feature] Add "prefer" filters

Is your feature request related to a problem? Please describe.
With many, many results it'd be nice to be able to sort the field of results without throwing out the candidates entirely.

Describe the solution you'd like
A prefer command to match for specific terms to cause contexts containing them to rank higher in search results.

[Feature] Add command for loading/running commands from file

This is a stepping stone to being able to load and save search state.

This should operate similarly to .septum/.config files where commands are run, line-by-line as if they were typed:

For example, source my_commands_to_run might result in:

> clear-dirs
> clear-filters
> add-dirs C:/dev/my_project/
> add-dirs C:/dev/other_library/
> only-exts c h 

Appropriate error messaging should be provided for when a command file cannot be run.

Unable to run commands from my_commands_to_run - file does not exist.
  • Files being sourced should not be able to create a cycle, resulting in infinitely sourcing.

Add integration testing

Integration tests would help verify behavior and provide examples of what Septum can do.

  • Provide a small interior project with source code for searching.
  • Provide a command file, which gets executed as if run by user input.
  • Given the command file, verify Septum's output against that an expected output file.

This should all be done without any external programs to simplify portability to multiple platforms.

Possible implementation:

  • Create a separate septum-integration-tests.gpr file which uses GNAT.OS_Lib and/or GNAT.Expect for building and running septum. See AdaCore gem 54 for examples

[Feature] Include/exclude searching in files whose name match some regex

Is your feature request related to a problem? Please describe.
It seems possible to only search in files that have a specific extension, but it's not possible to (exclude) search in files that start/contain a specific string or are in some specific folder.

Describe the solution you'd like

  • Be able to only/exclude search in files that start with some string or match some regex. For example, only search in files a-*.ads or exclude *_test.cu (like #13)
  • Be able to exclude files that are in some folder at an arbitrary depth. For example exclude files in ./**/test/ or ./**/examples/**/ (** here means a hierarchy of one or more folders)

[Feature] Config improvements

Is your feature request related to a problem? Please describe.

Configuration files don't support blank lines or any sort of comment.

Describe the solution you'd like

Allow blank lines and use # as the first non-whitespace character as a comment.

Suggestions for code style improvement

I have reviewed your work and have some suggestions for improvement. I would say that String can replace Unbounded_String in just about all cases.

  1. Use Ada.Containers.Indefinite_Vectors/Ordered_Maps/Holders instantiated with String instead of Unbounded_String vectors and maps.
  2. Introduce types for vector Index_Type like Line_Number etc instead of Positive.
  3. subtype String_Vector is String_Vectors.Vector etc just after container instantiation. This will make the code shorter and lighter.
  4. Use String parameters instead of Unbounded_String.
  5. Add typing with types or/and subtypes like Directory_Name / File_Name / Program_Line from String.
  6. Use subtype nearly like an alias of common datatypes in packages using them. Ie subtype String_Vector is SP.Strings.String_Vectors.Vector in packages using a lot of String_Vectors.Vector.

I hope the suggestions can be used. Exited to get a macOS version soon..;-)

[BUG] Help output is printed slowly

Describe the bug
The output printed by help is printed quite slowly.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the prompt
  2. Type 'help' and press the enter key
  3. It takes like 1 or 2 seconds to print everything

Expected behavior (if applicable)
See the help text getting printed more or less instantly

Desktop (please complete the following information):

  • OS: Arch Linux
  • Version: Built from Source

Additional context
Minor issue.

[Feature] Option for "Search on filters changed"

When iterating with filters, it's irritating to keep having to do match-contexts or match-filters every time filters are changed.

Provide some configuration option to automatically do match-contexts or match-filters whenever filters are added. It's not entirely clear if it's also useful behavior when filters are removed as well.

[Feature] Filter test function

Are your filters set up correctly?

This is especially a problem with regular expressions. Yes, you wrote it, but will it capture what you want?

Add a test command which reports if the text following test will be caught by the current filter set or not. This could also be test mode in which multiple lines of text can be entered with FOUND or IGNORED reported for each test line.

[Feature] Add last reload time to the prompt

Make it clear to users that they're operating off of a snapshot of the last file load.

Include text within the prompt to indicate the time since the last snapshot and/or the time of the last snapshot.

Possible solutions:

Last Snapshot: 15 minutes ago

or

Last Snapshot: 6/2/2021, 9:21 pm

[Feature] Pagination of results

Is your feature request related to a problem? Please describe.
With many results, it's hard to sort through sometimes. Being able to paginate results would help.

Describe the solution you'd like
Possible start/end values to match-contexts

[BUG] Restore terminal environment on exit.

The terminal environment isn't being restored on program close.

Trendy_Terminal.Shutdown should be called on exit. Due to some internals, this requires a second look at a clean way to properly do this, I'm thinking an RAII type in the main event loop.

[Feature] Use XDG directories for config files on Linux

Is your feature request related to a problem? Please describe.
septum init creates a file .septum/config in the current working directory, but I would like to create it relative to the home directory.

Describe the solution you'd like
When Septum tries to create .septum/config in the home directory, it should instead store it relative to $XDG_CONFIG_HOME. If this environment variable is not defined, it should have the value $HOME/.config. Thus the full path becomes $HOME/.config/septum/config.

Similarly, cache files (don't know if Septum has any) could be relative to $XDG_CACHE_HOME (which is by default $HOME/.cache).

Crash if no .septum/.config in ancestor tree where executing

Due to a bad post-condition:

    function Closest_Config (Dir_Name : String) return Virtual_File with
        Pre => Ada.Directories.Exists (Dir_Name),
        Post => Is_Regular_File (Closest_Config'Result)  -- <<<<<<<<<<<<<<
    is

which is bad because the result might be No_File.

[BUG] Typing tab key while in interactive search mode crashes the programme

Describe the bug
When typing the TAB key in interactive search, the program crashes

To Reproduce

  1. Launch septum in interactive mode
  2. Press the TAB key

Expected behavior (if applicable)
No crash

Desktop (please complete the following information):

  • OS: Linux Ubuntu Focal 20.04.3
  • Built from Source with Alire

Additional context

fred@localhost $ septum
septum v0.0.2


Files:      0                Extensions: Any
Distance:   7                Max Results: Unlimited
 > raised CONSTRAINT_ERROR : SP.Strings.String_Vectors.Constant_Reference: Index is out of range
[bin/septum]
0x42614c Sp.Strings.String_Vectors.Constant_Reference at a-convec.adb:326
0x493ef2 Sp.Interactive.Complete_Input at sp-interactive.adb:255
0x49bf58 trendy_terminal__io__get_line at ???
0x490e34 Sp.Interactive.Read_Command at sp-interactive.adb:291
0x495354 Sp.Interactive.Main at sp-interactive.adb:351
0x40f7c1 Septum at septum.adb:45
0x410309 Main at b__septum.adb:538
[/lib/x86_64-linux-gnu/libc.so.6]
0x7fde0e96d0b1
[bin/septum]
0x40f5fc _start at ???
0xfffffffffffffffe

Exception traceback: [bin/septum]
0x42614c Sp.Strings.String_Vectors.Constant_Reference at a-convec.adb:326
0x493ef2 Sp.Interactive.Complete_Input at sp-interactive.adb:255
0x49bf58 trendy_terminal__io__get_line at ???
0x490e34 Sp.Interactive.Read_Command at sp-interactive.adb:291
0x495354 Sp.Interactive.Main at sp-interactive.adb:351
0x40f7c1 Septum at septum.adb:45
0x410309 Main at b__septum.adb:538
[/lib/x86_64-linux-gnu/libc.so.6]
0x7fde0e96d0b1
[bin/septum]
0x40f5fc _start at ???
0xfffffffffffffffe

[BUG] Crash if input made before prompt shows

Program crashes if input is made while directories are being loaded, or when a search is occurring.

To Reproduce
Steps to reproduce the behavior:

  1. septum
  2. <MASH BUTTONS WHILE DIRECTORIES LOAD>
raised CONSTRAINT_ERROR : bad input for 'Value: "dfasdfasdf

D:\dev\ada\septum\bin\septum.exe]
0x7ff68ece8bf2 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ece72d8 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ece7334 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ebed47c at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ebed83a at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ebcb6c6 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68eb716d9 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ed0a7a9 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68eb71422 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68eb7113b at ???
[C:\Windows\System32\KERNEL32.DLL]
0x7ff96dba7032
[C:\Windows\SYSTEM32\ntdll.dll]
0x7ff96e40264f

Exception traceback: [D:\dev\ada\septum\bin\septum.exe]
0x7ff68ece8bf2 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ece72d8 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ece7334 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ebed47c at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ebed83a at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ebcb6c6 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68eb716d9 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68ed0a7a9 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68eb71422 at ???
[D:\dev\ada\septum\bin\septum.exe]
0x7ff68eb7113b at ???
[C:\Windows\System32\KERNEL32.DLL]
0x7ff96dba7032
[C:\Windows\SYSTEM32\ntdll.dll]
0x7ff96e40264f

Desktop (please complete the following information):

  • Windows 10
  • Septum 0.0.1-alpha11

[BUG] Broken build

Describe the bug
Build has been broken for a while:

  • xmlada doesn't build out of msys64 Github Actions. It works fine for me locally.

  • septum uses an unreleased version of Trendy_Terminal

  • Deploy a new version of Trendy_Terminal (0.0.2)

  • Follow-up on xmlada build discussion

[BUG] Pressing tab key after typing some text with a space at the end raises Constraint_Error

Describe the bug
A Constraint_Error is raised after pressing the tab key

To Reproduce
Steps to reproduce the behavior:

  1. Go to the prompt
  2. Type 'source ' (note the space at the end)
  3. Press the tab key
  4. Exception is raised and printed on the screen

Expected behavior (if applicable)
An error message or a list of files?

Desktop (please complete the following information):

  • OS: Arch Linux
  • Version: Built from Source (septum_0.0.4_b77a91de) (obtained with alr get septum)

Additional context
Add any other context about the problem here. If you got a stack trace, post that here.

The stacktrace didn't display line numbers (even though the executable has debug_info), but in gdb I get this:

#0  0x0000555556257ec6 in ?? ()
#1  0x0000555555597963 in sp.strings.string_vectors.constant_reference (container=..., 
    index=index@entry=2) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/adainclude/a-convec.adb:326
#2  0x000055555561ca6d in sp.interactive.complete_input (l=...)
    at /home/onox/septum_0.0.4_b77a91de/src/common/sp-interactive.adb:167
#3  0x000055555561eafe in trendy_terminal.io.line_editors.complete ()
#4  0x000055555561ffaf in trendy_terminal.io.line_editors.get_line ()
#5  0x000055555562088f in trendy_terminal.io.line_editors.get_line ()
#6  0x0000555555618e28 in sp.interactive.read_command (line_history=...)
    at /home/onox/septum_0.0.4_b77a91de/src/common/sp-interactive.adb:188
#7  0x000055555561d99f in sp.interactive.main ()
    at /home/onox/septum_0.0.4_b77a91de/src/common/sp-interactive.adb:242
#8  0x000055555557ef81 in septum () at /home/onox/septum_0.0.4_b77a91de/src/common/septum.adb:55

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.