Commit Graph

156 Commits

Author SHA1 Message Date
Janne Valkealahti
2d29050c34 Make Catalog browsers focusable with shortcuts
- Category and scenario list views can now be focused with
  ctrl+a/ctrl+s.
- Bind all keys with ctrl modifier
- Add "shortcut" concept to views which currently hooks to
  hot keys.
- In a catalog app by using a "shortcut" then takes the key
  event as a hot key, as it consumes resulting behaviour
  is to focus.
- Move view initInternal away from constructor call to
  require user to call init() which is not in a
  View interface
- Relates #826
2023-11-12 16:43:11 +00:00
Janne Valkealahti
ccf6d771d9 Add multiinput scenario
- InputView using viewcommands and has event for text change.
- Experimental way to handle tab navigation in a layout views.
- New viewcommands for tab navigation and moving cursor.
- Mouse click takes focus in AbstractView if no view command
  binding.
- MultiInputViewScenario now shows tab navigation.
- Fixes #917
2023-11-07 08:26:43 +00:00
Janne Valkealahti
bba7a82ab4 Make StatusBarView work with hotkeys
- StatusItem can now define a hotkey which is then
  bound to its action.
- In catalog app replace use of raw key event to
  item's hotkey for status bar visibility.
- Various doc updates.
- Relates #826
2023-10-30 09:31:03 +00:00
Janne Valkealahti
82df453cc0 Autoconfigure TerminalUI
- Add TerminalUIBuilder which can be used to build TerminalUI
- Add TerminalUICustomizer which can customize TerminalUI
- What is autoconfigured is TerminalUIBuilder.
- In TerminalUI add configure for views which now allows
  easier way to set needed stuff in views.
- Various changes in a catalog app
- Fixes #900
2023-10-25 09:10:42 +01:00
Janne Valkealahti
92eb7dd2b7 Relocate message package from view
- Relates #813
2023-10-20 08:48:36 +01:00
Janne Valkealahti
433c1f96f0 Relocate geom package from view
- Relates #813
2023-10-20 08:38:01 +01:00
Janne Valkealahti
8de0ef47df Better background handling in themes
- Modify view structures so that we're able to
  control background drawing better
- Remove transparent concept from box view
- Add background styles for dialog, menu/status bars
- Relates #824
2023-10-19 13:12:42 +01:00
Janne Valkealahti
52b242dcbf Polish scenario descriptions 2023-10-13 14:07:59 +01:00
Janne Valkealahti
da529fa277 Make samples native build fully optional
- Add springShellSampleNative project property
- Implement generic samples build logic in buildSrc
- Fixes #873
2023-09-24 08:37:32 +01:00
Janne Valkealahti
585125d2e3 TerminalUI can define rootView rect
- Add functions to calculate Rectangle for fullscreen/nonfullscreen modes.
- Fixes for rendering so that nonfullscreen works better with views.
- Add some basic samples
- isEmpty method for Rectangle
- Fixes #872
2023-09-22 09:00:22 +01:00
Janne Valkealahti
51c250608b Overhaul ListView to support checked states
- ListView can be defined to use nocheck, checked or radio
- List can now scroll through up/down
- Actual visual is handled in a DefaultListCell
- Modify/add scenarios and catalog app
- Relates #865
2023-09-09 08:59:37 +03:00
Janne Valkealahti
aa3c580220 Move interrupt message to ShellMessageBuilder
- Relates #761
2023-08-30 09:19:35 +03:00
Janne Valkealahti
a3ca69bc72 Non-fullscreen view
- ViewComponent can take view and drive it as non-fullscreen
- ViewDoneEvent which InputView now uses
- ComponentUiCommands is a sample where we add ideas for
  views in flow components
- Allow View to set eventloop
- Relates #850
2023-08-30 08:38:46 +03:00
Janne Valkealahti
ba5ab1a463 Dialog should float
- New WindowView which can be partially atop of background.
- DialogView now extends WindowView
- Change dialog in Catalog sample and Dialog scenario
- Relates #825
- Relates #855
2023-08-24 20:02:53 +03:00
Janne Valkealahti
88c1f56c71 Add about dialog to catalog app
- Relates #825
2023-08-24 08:46:09 +03:00
Janne Valkealahti
29417d495b Initial modal integration
- Integrate TerminalUI to ViewService and modals
- New Dialog scenario
- Relates #825
2023-08-21 09:37:05 +03:00
Janne Valkealahti
7391d0d24f Initial hotkey infra
- Duplicate keyhandler into hotkeyhandler
- Define some view to handle hot keys, like AppView and MenuBarView
- Catalog app binds some menus to hot keys
- Bind all normal keys a-z with alt
- Relates #823
- Relates #826
2023-08-10 08:27:49 +01:00
Janne Valkealahti
ef713638b2 Base theming for views
- Control is now aware of active theme name and resolver.
- Theme some settings in BoxView, ListView and MenuView.
- Overhaul scenario system to make it work with themes.
- Add new "background" StyleSetting.
- Relates #824
2023-08-04 14:19:33 +01:00
Greg Cooper
c5145a2fe6 Do not include timestamp for buildInfo. 2023-08-02 08:51:35 +01:00
Janne Valkealahti
3a2d7d4817 Restore focus after returning from scenario
- Relates #811
2023-07-22 17:27:21 +01:00
Janne Valkealahti
4b927be807 Hide statusbar in a catalog app
- Can clear items from a GridView
- Full refactor for AppView now using GridView internally
  and can hide/show menu/status.
- Add function key bindings f1-f10
- Modify catalog app to use new features in an AppView, listen
  F10 key to toggle statusbar visibility.
- Relates #805
- Relates #807
- Relates #811
2023-07-22 14:21:10 +01:00
Janne Valkealahti
c074af314b Add focused color and style for BoxView title
- May define focused color and style for title
  which overrides normal color and style if set.
- Use these in a catalog app.
- Relates #804
2023-07-21 09:26:31 +01:00
Janne Valkealahti
748f41103d Fix removed deprecation
- Fix property values which doesn't exist in gradle zip task anymore.
- Relates #821
2023-07-21 08:09:24 +01:00
Janne Valkealahti
a0bdbfc033 Initial terminal ui implementation
- This commit adds proof of concept work for terminal ui as is.
- Some things work, some don't but we need to start from somewhere.
  Further development continues in a main.
- Essentially we are starting to have enough so that it merits to
  move all this work into a main repo.
- Everything new is kept under org.springframework.shell.component.view
  and will get revisiter later to find correct locations for some classes.
- Catalog sample has been modified to provide "showcase" app for
  terminal ui features. This is a start while it already contains
  some usefull scenarios.
- Relates #800
- Relates #801
- Relates #802
- Relates #803
- Relates #804
- Relates #805
- Relates #806
- Relates #807
- Relates #808
- Relates #809
- Relates #810
- Relates #811
2023-07-15 16:42:39 +01:00
Janne Valkealahti
625619fc92 Add primary command sample
- New spring-shell-sample-catalog which is a skeleton meant for
  future view overhaul work.
- Relates #755
2023-07-05 10:35:30 +01:00
Janne Valkealahti
cdd703efa4 Fix alias usage with Command annotation
- Fix alias command extraction from existing @Command
  annotations so that we actually get multiple aliases
  defined if more than one defined on a method level.
- Fix rendering issue in a help stg template when
  multiple aliases exists.
- Fixes #796
2023-06-22 16:00:00 +01:00
Janne Valkealahti
811f1f9a55 Fix parser handling of positional args
- Change to have better support for args like:

    "--arg1 a --arg2 b"
    "--arg1 a --arg2 b c"
    "--arg1 a c --arg2 b c"
    "c --arg1 a --arg2 b"

  where option can have default values and position of
  positional args doesn't matter that much.
- Make parser to be aware of if it's handling last option
  so that we can differentiate if error can be given i.e.
  with too many args, etc.
- Fixes #795
2023-06-22 09:46:01 +01:00
Janne Valkealahti
c27b85fb0e Split sample app
- spring-shell-sample-commands and spring-shell-sample-e2e
- Needed changes in e2e tests and workflow
- Fixes #754
2023-06-15 10:49:52 +01:00
Janne Valkealahti
042d56e7e3 Add HandlerMethodArgumentResolver for @Option
- New OptionMethodArgumentResolver which is similar
  than ShellOptionMethodArgumentResolver for @ShellOption.
- Add missing annotation commands for e2e test command.
- Fixes #767
2023-06-07 15:28:57 +01:00
Janne Valkealahti
8bed75ad77 Support plain boolean without option annotations
- Fix so that we can have `boolean arg` without using
  `@Option` or `@ShellOption` defaulting to false.
- Fixes #744
2023-05-20 14:49:21 +01:00
Janne Valkealahti
9d27466c6a Support explicit arity min max with @Option
- @Option now has arityMin/arityMax which if defined,
  non-negative, are used instead of arity.
- Fixes #731
2023-05-01 08:36:41 +01:00
Janne Valkealahti
5a4a241cb8 Refactor short option docs
- Add e2e samples
- Add short option snippets as tabs content(to get later
  converted to an actual tabs).
- Relates #637
2023-04-10 14:48:57 +01:00
Janne Valkealahti
2e19929a32 Fix option type parsing
- In `CommandRegistration` add `ResolvableType` for `OptionSpec` giving
  more spesific handling of a type.
- In `CommandParser` handle source and target types so that we
  have generics with `List`, `Set` and arrays working better.
- In `HandlerMethodArgumentResolver` add better handling for
  `ConversionService` for generic types.
- In `StandardMethodTargetRegistrar` add better types via `ResolvableType`
  now that `CommandRegistration` support it.
- In `OptionConversionCommands` remove converter from `String` to `Set` as
  now things should work as is if generic in a `Set` has a converter.
- Backport #694 #699
- Fixes #700
2023-04-05 18:56:09 +01:00
Janne Valkealahti
64abc1da22 Fix positional args with new parser
- Better alignment for use of positional args without using
  an option.
- Should work similarly with old parsing framework.
- Change position where missing options are checked.
- Fixes #701
2023-04-05 13:42:22 +01:00
Janne Valkealahti
93f2cf00de Rename name to provider
- Align naming in CommandAvailability
- Relates #663
2023-03-13 08:54:23 +00:00
Simon Verhoeven
60126b9c47 Rename setMaskCharater to setMaskCharacter 2023-03-12 16:08:54 +00:00
Janne Valkealahti
eaa3e5caf9 OptionValues supports multiple resolvers
- Change ref field in OptionValues to providers
  takin an array.
- Relates #637
2023-03-05 16:38:01 +00:00
Janne Valkealahti
3d3d37294f Use correct type with set
- When target is set and only one option argument is given,
  we should not convert to list as user expects string to xxx
  Converter to work.
- This is how it used to work and previous changes caused
  regression.
- Bug is actually in an old parser and new parser works fine.
- Fixes #667
2023-02-18 14:19:56 +00:00
Janne Valkealahti
cf1a6f7839 Add support defining Availability with annotated method
- This is for new annotation model
- @CommandAvailability which takes names of
  AvailabilityProvider beans supplying Availability info.
- Relates #663
2023-02-09 21:18:22 +00:00
Janne Valkealahti
75b8a0c90e Rework command parser
- Previously CommandParser contained parser which was
  scannerless type of brute force parsing of command
  line args.
- Contract in that old parser wasn't super clear what
  is its role with caller as it was given options
  and registration was parsed in a Shell class.
- Add completely new parser package which has better
  model and which will be much easier to modify for
  future needs.
- Change some interfaces around parsing so that we do
  as much in this new parsing model instead of pre-parsing
  something in a Shell class.
- We also try to move away from using exceptions as
  a message delivery which had its own problems. Instead
  introducing parser messages which gives better info
  when errors are detected.
- Add ParserConfig class which allows to expose settings
  to change some parser features. Later this will be
  exposed to user so that some features can be turned on/off
  for an actual shell needs.
- Fixes #646
2023-02-08 15:47:08 +00:00
Janne Valkealahti
006ed5e443 Better e2e tests coverage
- Add integration tests for e2e samples.
- Add some missing commands for new annotation system.
- Fixes #654
2023-02-05 16:21:45 +00:00
Janne Valkealahti
de1a3baf18 New annotation model
- This is a first commit to add new annotation model
  which eventually will replace old legacy annotations
  like ShellComponent, ShellMethod, @ShellOption, etc.
- Adds subset of features needed for parity with manual
  use of CommandRegistration.
- Relates #637
- Relates #638
- Relates #639
- Relates #640
- Relates #641
2023-01-27 12:04:21 +00:00
Janne Valkealahti
03b343812d Reorganise e2e samples
- Fixes #642
2023-01-26 14:18:24 +00:00
Janne Valkealahti
624343ace2 Handle collection types in a parser
- Handle any option collection type so that list is generated for
  values, this then works well when actual type conversions happen.
- Fixes #630
2023-01-19 17:33:18 +00:00
Janne Valkealahti
56b9cb20ef Document String array option type
- Fixes #628
2023-01-19 11:32:37 +00:00
Janne Valkealahti
a04091c08f Support modify option names
- New OptionNameModifier which is just a Function<String,String> to
  modify a name.
- Can be defined per option in CommandRegistration.
- Can be defined as global default as bean.
- Default implementation for common case types is enabled via boot's
  config props under spring.shell.option.naming.case-type
- Support facilities for camel, kebab, snake and pascal conversions.
- Fixes #621
2023-01-15 10:02:55 +00:00
Janne Valkealahti
95e2829dc3 Revisit positional arguments
- Add better mapping logic
- Add better type conversion
- More docs for arity and positional option configuration
- Fixes #616
2023-01-13 15:11:38 +00:00
Janne Valkealahti
b10786814a Handle arity errors
- Introduce new error TooManyArgumentsOptionException
  and NotEnoughArgumentsOptionException.
- Parser not tracks arity min/max and imposes
  if num of option arguments.
- CommandParserExceptionResolver contains better error
  message handling for these containing more context
  for a user.
- Fixes #614
2023-01-12 11:26:20 +00:00
Janne Valkealahti
f91b255bda Create BuilderSupplier interface
- Fixes #607
2023-01-08 13:38:33 +00:00
Janne Valkealahti
9b4e347633 Add unrecognised option support
- This commit modifies CommandParser to better track positional parameters
  which previously used to go there for non-recognised options. Now using
  relatively dump logic of just checking if first positional parameter starts
  with '-' which indicates it's a candidate for a new `UnrecognisedOptionException`
  which then would give user an error "Unrecognised option '--xxx'" for example.
- Fixes #601
- Fixes #602
2023-01-07 08:58:40 +00:00