Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fishline v3.0.0 #20

Merged
merged 31 commits into from
May 7, 2017
Merged

Fishline v3.0.0 #20

merged 31 commits into from
May 7, 2017

Conversation

0rax
Copy link
Owner

@0rax 0rax commented May 21, 2016

Description

This new version of fishline consist of a complete refactoring of the code base to elevate a lot of internal feature of fish that were left aside originally. Its also contains some small changes to be compatible with the new 2.3.0 version of fish.

Changelog

Breaking changes

  • Initialization script is now name init.fish instead of fishline.fish in order to be compatible with plugin managers such as fisherman. When upgrading from fishline v2 you will need to update your loading script for fishline (see the Installation section of this comment).
  • Theme symbols FLSYM_{LEFT,RIGHT}_PRE and FLSYM_{LEFT,RIGHT}_POST have been moved around to make way more sense. PRE is now used when a segment opens and POST when it closes. PRE and POST are now named around the segment it belongs to and not the separator as previously. This can break themes that were using those symbols and values for those variables should be swapped around.

Major changes

  • Initialization script now elevate fish function autoloading instead of loading everything itself. This makes the initialization script faster. It also makes segment modifications and new segment load automatically.
  • The entire code base has been refactor to be more idiomatic.
    • The only exposed function is now fishline
    • All internals and segments are now prefixed by a __ making them show as private function (i.e not shown when listing functions using functions)
    • Segment and tests are now separated in 2 different files (segments/__flseg_segment & tests/fltest_segment)
    • Segment names are now written in snake_case and expose a function named __flseg_segment_name in a file with the same name (necessary for fish autoloading).
    • All internals have also been renamed in snake_case with the private __fishline_ prefix instead of publicly exported FLINT_
    • Tests are no longer loaded by initialization script and are only available when specifically sourced or when using tests/run.fish
  • Segment names when calling fishline are now case insensitive (for backward compatibility)
  • Add sensible default depending on system info
    • themes/tty_compatible.fish will be loaded by default when fishline init's detect its running in a tty
    • themes/default_ansi_colors.fish or themes/default_256_colors.fish will be loaded depending on tput colors output
    • default 256 colors theme has also been updated and is now different from previous version (old color theme is still available as themes/legacy_256_colors.fish)
  • Segment symbols are now stored in a theme file instead of the segment files itself (easier for theming)
  • Added new internal __fishline_segment_close (cleaner that using an optional argument to __fishline_segment)
  • New segment separator that just creates an empty segment
  • New segment fish that prints a goldfish in your prompt
  • New segment invert that will invert the next segments opening (allowing to create diamond shaped instead of arrow shaped segment)

Minor changes

  • Update vimode segment to be compatible with fish v2.3.0
  • Update pwd segment to use prompt_pwd function instead of pwd directly as fish v2.3.0 now permit customization of abbrev length
    • Using fish_prompt_pwd_dir_length you can now specify directory abbreviation length for this segment and prompt_pwd in general
  • Add small help and small util options to fishline function
    • fishline -h shows a small usage for fishline
    • fishline -x lists all available segment
    • fishline -v show fishline version
  • tests/run.fish now have a small help, does not run all tests by default & can load themes for you
    • tests/run.fish -h show a small usage for the test framework
    • tests/run.fish -t theme.fish asks the test framework to load a theme before runing tests
    • tests/run.fish -a runs all tests for all segments
    • tests/run.fish segment_name run tests for segment_name segment
  • Some minor optimizations and modifications to internals

Documentation

The whole documentation requires an update to reflect the changes made by the big refactoring that this version consist. The wiki will see some drastic change in the near future in order to reflect all of it, the Development section will also finally be updated.

Installation

Upgrading

As stated before, the initialization script of fishline has been changed thus require you to change how you are loading fishline. When upgrading from fishline v2 you will need to update the section where you load fishline reflect this change. You will simply need to change:

  set FLINE_PATH $HOME/.config/fish/fishline
- source $FLINE_PATH/fishline.fish
+ source $FLINE_PATH/init.fish

You previous configuration should work exactly as it was with previous version (including fishline v1).

New installation

For a brand new installation, the README.md have all the necessary information required to install and configure fishline.

Using Fisherman

It is to note that this release adds the support for installing fishline using fisherman. It also add the possibility to share your fishline theme and configuration using this plugin manager (see 0rax/sharktooth for a simple example of how this could be done).

To install fishline using fisherman you will just need to run:

fisher i 0rax/fishline

You will then still need to create your own fish_prompt to use fishline for your prompt as we do not provide a default fish_prompt or fish_right_prompt by default. If you wish to install a default prompt & theme along with fishline see 0rax/sharktooth.

We know that some people may not like to use of a package manager to configure its shell (me included) and we want to make clear that fishline is made to work as a standalone prompt framework for fish and will never require you to use a third party software to install or manage it (except Git of course 😄).

0rax added 19 commits May 15, 2016 02:41
- Segment, Tests, Glyphs & Colors are now all separated
- Provide sensible default_colors.fish & default_glyphs.fish
- Fishline now uses fish_functions_path to autoload its internal
  functions and segments
- Use an init.sh script to load default config & update
  fish_functions_path
- Glyphs are now provided in the themes/default_glyphs.fish file instead
  of in each segment file (easier for theming)
- Tests are now separated and loaded only when needed
- Provide a FLINT_VERSION fuction (associated with the fishline -v flag)
  to make debuging easier
- init.fish is now in the root of the repository (as it is not really a
  config file)
- internal functions are moved to an internals folder as only the
  fishline function should be 'public'
- internals/ now refers to internal functions
- functions/ now refers to exposed functions to the user
- segments/ still refers to segment dirs
- tests/ now refers to test files
- themes/ still refers to different availlable theme
- Add -x option to list all availlable segment
- Add -v option to show fishline version
- Add -h option to show a small usage for fishline
- Update test/run.sh to use `fishline -x` to list availlable segment
- Default colors:
  - Now provide a default_ansi_colors theme & deafult_256_colors
  - It is loaded by default via init.sh based on `tput colors` output
- Default symbols:
  - default_glyphs.fish has been rename to default_symbols for clarity
  - Now load default_glyph by default when terminal is not perceived as
    a TTY & tty_compatible instead when perceived as one
- VIMODE: remove force delete of fish_mode_prompt as it was shown the
  first time nonetheless. Will require the user to deactivate the
  default fish_mode_promopt by creating an empty function
- PWD: now uses prompt_pwd instead of the path directly as some
  modification will be added to this function alowing the user to set
  the abbreviation length (fish-shell/fish-shell#2473)
- fishline internal commands are now registered as private function
  using the `__` prefix notation
- This way when listing all availlable function using `functions` you
  will not have all the fishline internal command shown
- Some discussion need to be made for segments (does we need to register
  them as private or not)
- `__FLINT_SEGMENT` & `__FLINT_SEGMENT_CLOSE` now replace old `FLINT_CLOSE`
  for better clarity
- Added small README.md in internals about what are the internal
  variable and function used, by what function and what they are used for
- Internal command are now prefixed with __fishline_ instand of __FLINT_
- FLINT_ prefix is now reserved for internal variables and cleanup after
  execution
- New namiong convenvtion for internal command will require this prefix
  & the use of snake_case instead of full UPPER_CASE
- segment are now prefixed by `__flseg_` instead of `FLSEG_` making them
  show as private function in fish's `functions` listing. All name are
  now in lowercase to match an standard idomatic shell naming covention
- tests prefix have also changed from `FLTEST_` to `fltest_` with the
  same change for the naming convention.
- tests/run.sh has been modified with a quick usage & the possibility to
  load themes before testing any segment
- init.fish will now elevate realpath on system where it exists or when
  running fish 2.3
- this will help 3rd party installation such as the one using fisherman
- Add a new 256 colors default theme
- Add separator color to default themes
- Keep old default theme as `themes/legacy_256_colors.fish`
@0rax
Copy link
Owner Author

0rax commented May 26, 2016

Bugfixe required before merging

0rax added 9 commits May 29, 2016 21:28
- Sigstatus now use a initiliazed list of status name generated from
  `kill -l`
- Should work on all kill implementation that list status from 1 to 31
  in order when doing a `kill -l`
- Should be a little bit more efficient as we are now just querrying a
  variable instead of calling kill everytime
- rename signal code variable to FLSEG_STATUS_NAME
- add information about this var in internals/README.md
- Add `FLINT_INVERT` global variable & logic to create an inverted open to
  a segment (making diamond shape segment possible with powerline glyphs)
- Segment logic has been updated to control a whole segment and not just
  the creation the opening of one via the use of global var (next point
  uses this to provide better customization to your segment)
- Add `pre` and `post` optional argument to `__fishline_segment` which
  allows you to ignore `FLSYM_{LEFT|RIGHT}_PRE` and
  `FLSYM_{LEFT|RIGHT}_POST` in the segment creation.
- Add `FLINT_PRINT_POST` global variable which is used by the new
  arguments of `__fishline_segment` to control printing of
  `FLSYM_{LEFT|RIGHT}_POST` when closing the segment
- Breaking change in themes is introduced as post & pre have been
  inverted as we now want to consider them inside a segment instead of
  as post & pre of a segment separator
- With the updated logic of `fishline`, FLINT_BCOLOR is now a global
  variable present for the whole execution of the the main function and
  does not need to be removed by the segment. The logic that needed
  this is also now externatlized to `__fishline_segment_close`.
- separator segment now uses the new `__fishline_segment` logic instead
  of a dirty hack
- Simple empty segment that just control the invert factor of the next
  segment.
- Add colors & symbols for `separator` segment
- Invert `FLSYM_{LEFT|RIGHT}_POST` and `FLSYM_{LEFT|RIGHT}_PRE` to
  matche `__fishline_segment` breaking changes.
- Print a fish using powerline segment if used in your theme
- Else will print an ascii art of a fish `>((*>`
- Fixes #21 on system using procps-ng
- Change the logic of sigstatus segment to use a static list of signame
  instead of calling kill everytime
@0rax 0rax self-assigned this May 7, 2017
@0rax 0rax merged commit eaa39bc into master May 7, 2017
@0rax 0rax added release and removed enhancement labels Jul 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant