Commit graph

33 commits

Author SHA1 Message Date
84091f398d
feat: add Enbas CLI schema and code generator
Summary:

- Created a custom CLI schema for Enbas which will act as the Source
  of Truth for code and document generation.
- Created a code generator which uses the schema to generate the
  executor definitions and code in the internal usage package.

Changes:

- Created the Enbas CLI schema as the Source of Truth for Enbas.
- Created the code generator that generates the executor
  definitions and code in the usage package.
- Regenerated the executor definitions using the code generator.
- Moved the custom flag value types to the new internal flag
  package.
- Created a new flag value type for the bool pointer to replace the
  flag.BoolFunc() used for the sensitive and no-color flags.
- Moved the version and build variables to the new internal version
  package to simplify the version executor.
- Created a new usage package and moved the usage functions there.
- Changed the type of the account-name flag from string to the
  internal StringSliceValue type.
2024-08-13 14:53:26 +01:00
3d20adfa57
chore: REUSE.toml
- Replace .reuse/dep5 with the new REUSE.toml file.
- Add licensing information to REUSE.toml and remove the licensing
  headers from the source files.
2024-08-01 04:01:38 +01:00
42251f6df8
feat: add configuration support to enbas
SUMMARY

This commit adds configuration support to enbas. The configuration is
stored as a JSON file in the user specified configuration directory.

When using enbas for the first time, the user will first need to
execute the new init command in order to generate the configuration.
Once this has been generated the user can edit the settings to
personalise their experience, login to their account and use enbas as
normal.

For now the configurable settings included in the configuration
are as follows:

- The path to the credentials file (by default this is set to a file in
  the same directory as the configuration file).
- The path to the cache directory.
- The character limit used for line wrapping.
- The programs used for integrations such as paging, media viewing,
  opening URLs, etc.

CHANGES

- added the new config type.
- added the new init executor for generating a new configuration file.
- removed the following top level flags in favour of the new
  configration support.
    - cache-dir
    - pager
    - image-viewer
    - video-player
    - max-terminal-width
- added a new error type for use when an unknown media attachment ID
  is specified.
- updated the usage function for the executors to support a case
  where a flagsets has no flags.
- update .golangci.yaml to disable some linters
2024-06-25 12:39:39 +01:00
632a620180
feat: view media with external applications
This commit adds integration to external image viewers and video players
to allow users to view image and video attachments.

Enbas creates a cache directory where the media is downloaded to before
opening the external program for viewing.

Users can view one or more media attachments from a single status.
2024-06-22 01:16:24 +01:00
56445601a3
feat: add support for muting and unmuting accounts
Now that muting and unmuting accounts are now supported in GoToSocial
(as of version 0.16.0) Enbas can now allow users to do that.

Users can also see a list of accounts that they've muted.
2024-06-18 04:59:32 +01:00
ccdd8b6530
fix: add a new internal printer
Add a new internal printer package for printing resources to the screen
or pager.

With the new printer in place, most of the settings such as the pager
command, colour theme, whether or not colour output is disabled, etc
are defined in one place which saves us the trouble of passing an
increasing number of parameters to an increasing number of Display
methods throughout the code base.

The old Displayer interface and associated Display methods in the
model package are removed as this is now handled by the printer.

The format functions in the utilities package has essentially been
rewritten as methods to the Printer type.

Additional changes:

- All indentation when displaying information about resources (e.g.
  statuses, instance, accounts) are removed.
- The application's build information now has colour output.
2024-06-17 18:59:20 +01:00
c04cd7e8a5
refactor: update code for the executor package
Changes:

- moved the command names from main to the executor package.
- moved the unknownCommandError to the executor package and renamed it
  to UnknownCommandError.
- define the command summaries within the executor package.
- replace the switch statement in main.run() with a hashmap for looking
  up the corresponding executor to the given command.
- transformed BlockExecutor to BlockOrUnblockExecutor.
- transformed FollowExecutor to FollowOrUnfollowExecutor.

Additional fixes:

- fixed flag for the version executor.
2024-06-10 18:59:01 +01:00
5fb55ed2cf
feat: accept or reject follow requests
Add support to allow users to accept or reject follow requests.
2024-06-10 10:58:43 +01:00
db16e4aa16
feat: add pager support
Add support for printing the output of timelines, long statuses, etc to
an external pager of the user's choice.
2024-06-09 15:58:10 +01:00
c8187587a8
fix: print commands in aligned columns
Use the text/tabwriter to write the commands and their summaries in
aligned columns when printing the help text.
2024-06-06 06:21:16 +01:00
c6c711c29b
fix: update error handling
Changes:

- Move InvalidListRepliesPolicyError, InvalidTimelineCategory,
  InvalidStatusVisibility and InvalidStatusContentTypeError type to the
  model package.
- Clean up some code in regards to the parsing of the Enum types.
- Clean up the error messages sent back to the user.
- Use colons instead of semicolons when unwrapping error messages.
- Print errors to Standard Error (os.Stderr)
2024-06-02 11:35:43 +01:00
c05cce9154
chore: make the project REUSE compliant 2024-06-02 07:53:13 +01:00
bff1eba972
feat: add NO_COLOR support
Add support for disabling ANSI colour output via the --no-color flag
or the NO_COLOR environment variable. The suggested implementation was
inspired by the standards defined at no-color.org
2024-05-31 21:18:11 +01:00
55b93c6586
fix(breaking): update project structure
Move all executors to the internal folder package. This PR also comes
with additional breaking changes.

Changes:

- refactor: move all executors to the internal/executor package.
- refactor: update naming patterns for constants, variables, custom
  types, etc.
- fix(breaking): renamed the update command to edit.
- fix(breaking): update the flags for the switch command to make it
  more generic.
- fix(breaking): renamed the show-account-relationship flag to
  show-relationship.
- fix: update the print message from the whoami command.
2024-05-23 18:06:49 +01:00
421c21bf52
feat: allow users to specify the config directory
Allow users to specify their preferred configuration directory by using
the top level flag (a.k.a 'global flag') --config-dir. This also
introduces the design of baking top level flags into the executor.
2024-05-22 23:30:09 +01:00
ecc8d51c09
feat: private notes
This commit allows users to add or remove private notes from
accounts.

Changes:

- feat: added functionality to add or remove private notes from
  accounts.
- fix: added new error types or unsupported add and remove
  operations.
- build: build Enbas without rebuilding all packages by default to
  speed up local builds for development.
2024-05-22 11:58:56 +01:00
6e40792fec
fix: redesign the add and remove commands
Redesigned the add and remove subcommands so that it is easier to add
logic when adding and removing additional resources.
2024-05-21 23:05:23 +01:00
f6d67a98e0
fix: use the account name instead of account ID
The user will now specify the account name instead of the account ID
when performing operations such as following and blocking. Enbas will
lookup the account and retrieve the account ID before sending the
request to GoToSocial. This prevents the user from having to retrieve
the account ID themselves which should make it a bit easier to use.
2024-05-21 21:06:18 +01:00
9d8cb2c68e
refactor: add new AccountList type for accounts
Add a new AccountList type for handling the printing of different list
of accounts (such as following, followers and blocked accounts).
2024-05-21 14:30:50 +01:00
dffd324243
feat: block and unblock accounts
This commit adds the functionality to allow users to block and unblock
accounts. The user will also be able to view a list of blocked
accounts.
2024-05-21 13:19:53 +01:00
a77f3741a0
feat: show user preferences
Optionally show the user's preferences when viewing account.
2024-05-20 19:46:05 +01:00
de5cf65aa8
fix: use my-account flag for showing followers
Allow the use of the my-account flag when showing followers
and following accounts for the authenticated user.
2024-05-20 18:37:29 +01:00
1a95384ba0
feat: followers and following others
This commit adds the ability to follow and unfollow (remote)
accounts and to display a list of followers and followees for
a specified account.

Changes:

- Added a command to follow an account.
- Added a command to unfollow an account.
- When displaying an account you can optionally view the relationship
  between that account and yourself.
- Added a command to view accounts that are following a specified
  account.
- Added a command to view accounts that are followed by a specified
  account.
2024-05-20 17:31:50 +01:00
32ca448ae7
feat: add and remove accounts from a list
Summary:

This commit adds the ability to add and remove accounts from a list.

The list models has also been updated to change the way lists are
displayed on screen.

Changes:

- Added a subcommand to add accounts to a list.
- Added a subcommand to remove accounts from a list.
- Added a custom error for unknown subcommands.
- Added a custom error when no account IDs are specified when
  expected.
2024-05-19 11:48:36 +01:00
4f694465bf
fix: update FlagSet code
- Added constants for flag names and resource types
- Added an error type for when a required flag is not set
- Added an error type for when an unsupported resource type is specified
- Renamed timeline-type to timeline-category
2024-02-28 19:35:18 +00:00
c507815ef6
feat: add the whoami command
The whoami command shows the user the name of the account they are
currently logged in to.
2024-02-28 14:09:12 +00:00
bc18c00c69
feat: add ability to interact with lists
Add the ability to create, update, list and delete lists.

Note, adding accounts or removing them from lists is not scoped
in this PR.
2024-02-27 19:52:59 +00:00
c38689fe28
fix(breaking): update the credentials filename
Save the credentials to the credentials.json file in the config
directory.
2024-02-27 09:31:17 +00:00
5a795c8ae0
refactor: remove dependency on golang.org/x/oauth2
This commit refactors the login flow to a GTS server thanks to an update
in the official GTS documentation.

golang.org/x/oauth2 is no longer needed.

Documentation reference:
- https://docs.gotosocial.org/en/latest/api/authentication/
2024-02-25 06:41:13 +00:00
a83aaa17f6
feat: add timeline support
Add support for viewing all timeline types (home, public, lists and
tags).
2024-02-24 15:53:29 +00:00
e6ec5c71b6
refactor: implement the Stringer interface
Account, Instance and Status now implement the Stringer interface.
2024-02-23 14:19:12 +00:00
4f561f9305
feat: add ability to show a status 2024-02-23 13:14:50 +00:00
2c5123253a
feat: add Enbas
Add Enbas code. So far Enbas can:

- Allow the user to register the application and log into GTS on their
  behalf. The scope is limited to read for now.
- Show instance details.
- Show local and remote accounts.
2024-02-23 09:44:57 +00:00